I have Ajax call which return JSON in response, Backend is written in servlet, and I have set content-type
and character-set
as well
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
But in Ajax response , I see gibberish character like Bullet turns into � .
Any idea why this is happening?
Thanks in Advance.
3
Answers
This is a replacement character:
It is used to indicate problems when a system is unable to render a stream of data to a correct symbol. It is usually seen when the data is invalid and does not match any character
https://en.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character
Don’t use bullet directly. Use the equivalent hexcode or html code and it should work.
The browser/DOM doesn’t identify some characters. Check the link below:
https://www.toptal.com/designers/htmlarrows/punctuation/bullet/
Possible solutions to this problem can be :
In my case, it was utf8 [or you can use utf8mb4 based on your needs].