Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Character encoding problem with pound sign

Avatar

Level 2

Hi everyone,

 

We have implement a servlet which returns values in json format. The values are retrieved from an external api call and saved in crx/de, then filtered and returned in json format using a servlet. In the response any string that contains a pound sign is displayed as �. The character encoding of the response is set to 'utf-8'. We are using AEM 6.5.12. Any idea how we can fix this? Thank you.

0 Replies

Avatar

Level 5

@Mhatri  Can you try-

response.setContentType(ContentTypeUtil.TYPE_JSON);
response.setCharacterEncoding(CharEncoding.UTF_8);

Avatar

Level 2

Thank you for your response @manjunathdj . Content type and character encoding are set for the response but still getting the same issue.

Avatar

Community Advisor

Hi @Mhatri ,

I vividly remember, we were even facing similar issue for encoding such special characters. I would suggest to implement some custom logic to achieve the same.

Regards,

Santosh