Skip to main content
New Participant
October 25, 2022
Question

Character encoding problem with pound sign

  • October 25, 2022
  • 3 replies
  • 1285 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.

3 replies

SantoshSai
New Participant
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
manjunathdj
New Participant
October 25, 2022

@mhatri  Can you try-

response.setContentType(ContentTypeUtil.TYPE_JSON);
response.setCharacterEncoding(CharEncoding.UTF_8);
MhatriAuthor
New Participant
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.