JCR/POST encoding issue with characters like ľ š č Å¥....

Avatar

Avatar
Level 1
jozefp
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
jozefp
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
View profile
jozefp
Level 1

19-02-2017

Hello everyone,

this is second post here, but now i have little bit more information this time.

I am still experiencing encoding issue when AEM/Sling is saving POST request to JCR.

Apache Sling request parameter handling - Default Parameter Encoding - is set to UTF-8

I have tried code attached below on instances of sling & AEM. Here are my results:

  • (instance) - (Default parameter encoding setting) - (without _charset_ in request/ with _charset_ in request)
  • Sling - not set - broken/working
  • Sling - UTF-8 - working/working
  • AEM(clean installation) - not set - broken/working
  • AEM(clean installation) - UTF-8 - broken/working
  • AEM(with our code) - UTF-8 - broken/working

We have also tried to set encoding of the request in the filters but it was not working.

Example after running both FORMs from code below:

<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java" %> <% response.setCharacterEncoding("UTF-8"); %> <html > <head> <meta charset="UTF-8"> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> </head> <body> <form method="POST" action="/content/joz/jcr:content" enctype="multipart/form-data"> text:<input type="text" name="textWith" value="ľ š č Å¥ ž ý á í"/><br> <input type="text" name="_charset_" value="UTF-8"><br><br> <input type="Submit" /> </form> <br><br><br><br> <form method="POST" action="/content/joz/jcr:content" enctype="multipart/form-data"> text:<input type="text" name="textWithout" value="ľ š č Å¥ ž ý á í"/><br> <input type="Submit" /> </form> <br><br><br><br> <form method="POST" action="/content/joz/jcr:content" enctype="multipart/form-data"> DELETE <input type="hidden" name="textWithout@Delete" value="delete text" /> <input type="hidden" name="textWith@Delete" value="delete text" /><br> <input type="Submit" /> </form> </body> </html>

I don't really know what more can I do to solve this issue.

Is there any Encoding config for JCR, servlet or anything else?

Thanks for any help.

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar
Give Back 10
Level 2
DavidZhang
Level 2

Likes

6 likes

Total Posts

28 posts

Correct reply

0 solutions
Top badges earned
Give Back 10
Boost 5
Give Back 5
Validate 1
Boost 3
View profile

Avatar
Give Back 10
Level 2
DavidZhang
Level 2

Likes

6 likes

Total Posts

28 posts

Correct reply

0 solutions
Top badges earned
Give Back 10
Boost 5
Give Back 5
Validate 1
Boost 3
View profile
DavidZhang
Level 2

16-07-2021

Our problem is more weird than this, our exact the same code and form work on author, but when submit through publisher, no matter what's the trick you listed below, the Spanish character in the submitted input fields messed. The final solution is when AEM start, put  -Dfile.encoding=UTF-8 in the aem start command, then problem resolved.