Expand my Community achievements bar.

SOLVED

AEM cloud | Chinese text | Node and Resource API returning unreadable text

Avatar

Level 2

Hi All,

 

I have Chinese content in node property. 

When I am reading this content using node.getProperty("text").getString()

 

or

 

ValueMap.get("text").toString()

 

Both these methods are returning non readable characters sequence like ??????

Could anyone help how to read Chine text in AEM. However English text is working fine.

 

Any pointers highly appreciated.

 

Thanks,

Pradeep

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
3 Replies

Avatar

Correct answer by
Community Advisor

Avatar

Employee Advisor

@pradeepdubey hi - You need to use character encoding in that case. 
Also note, you will always see ??? when printing into logs - please try to write it on response for testing.

Thanks,

Milind

Avatar

Level 2

I started and checked AEM in debug mode, text is in Chinese language, however log is printing invalid characters. 

When I copy paste the text on editor it is in Chinese only. Not sure why AEM node and resource API is not returning actual text.

Could you share any code/API which ensure same text is getting read and printed in logs?

 

Thanks,

Pradeep