Sign in to Community
Sign in to view all badges
Need help in reading some specific chinese chars from JCR repo.
I have one dialog where author enters content and save the page. Author created page for China and entered some content specific to China in the dialog and saved it.
When I try to read the below content from JCR it is adding ???? . I have tried adding utf-8 still not able to get the specific content.
String mDesc = properties.get("messageDescription", String.class);
If you are using Coral UI 3 textfield(granite/ui/components/coral/foundation/form/textfield) for your messageDescription field, try the solution highlighted in below article.
Setting utf-8 in hidden resource (Solution A) - https://helpx.adobe.com/experience-manager/kb/utf-characters-not-stored-or-displayed-properly-after-...
Also, check if UTF-8 is set at page component level (via meta tag in head section of a page)
If you're on latest version on AEM, you should not see this issue.
Try below approaches:
1. Make sure Default encoding is set to: utf-8 on Apache Sling Request Parameter Handling config.
2. Try below and see if it works:
String paramValue = "yourString";
byte bytes = paramValue.getBytes(StandardCharsets.ISO_8859_1);
paramValue = new String(bytes, StandardCharsets.UTF_8);
Let me know if it works or not.