Reading chinese chars using valumap prop.get adding ????? | Community
Skip to main content
Anny0505
Community Advisor
Community Advisor
September 22, 2020
Solved

Reading chinese chars using valumap prop.get adding ?????

  • September 22, 2020
  • 2 replies
  • 1609 views

Hi Everyone,

 

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);

result :<p>?????</p>

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Vijayalakshmi_S

Hi @anny0505,

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-saving-dia.html

Also, check if UTF-8 is set at page component level (via meta tag in head section of a page)

2 replies

Singaiah_Chintalapudi
Level 7
September 22, 2020

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.

 

Thanks,

Singaiah

Anny0505
Community Advisor
Anny0505Community AdvisorAuthor
Community Advisor
September 22, 2020

Thnak you Singaiah. Still it did not work

 

Vijayalakshmi_S
Vijayalakshmi_SAccepted solution
Level 10
September 22, 2020

Hi @anny0505,

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-saving-dia.html

Also, check if UTF-8 is set at page component level (via meta tag in head section of a page)

Anny0505
Community Advisor
Anny0505Community AdvisorAuthor
Community Advisor
September 23, 2020

Thank you @ Vijayalakshmi_S.

 

Actually When I save the dialog data saving correctly as shown in below. I need to read the data from publish instance and send it to some third party application. I have implemented listener to get the latest activated page content and reading data from the valueMap.

when I use  String mDesc = properties.get("messageDescription", String.class);  content converting to ?????.

Is there any other way to read this content? 

 

 

 

I Also went through the article and followed same steps no luck