Character encoding problem with pound sign | Community
Skip to main content
Level 2
October 25, 2022
Question

Character encoding problem with pound sign

  • October 25, 2022
  • 2 replies
  • 1290 views

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.

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

2 replies

manjunathdj
Level 1
October 25, 2022

@mhatri  Can you try-

response.setContentType(ContentTypeUtil.TYPE_JSON);
response.setCharacterEncoding(CharEncoding.UTF_8);
-Manjunath DJ
MhatriAuthor
Level 2
October 25, 2022

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

SantoshSai
Community Advisor
Community Advisor
October 26, 2022

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

Santosh Sai