Does this sound familiar? If so, I know how frustrating this can be because it took me hours to find a way to resolve this.
The problem is that the characters in question do not fall within the encoding of your webpage set via the meta ‘Content-Type’ tag. For example, a webpage using the UTF-8 character set will not display these characters correctly.
Lets imagine we are trying to alert TÃ¤mÃ¤ Rocks (Finnish for ‘This Rocks’), if we were to alert it straight out as below we would get the issue:
Instead, we need to use the hexadecimal equivalent prepended by ‘\x’ to get the characters to appear correctly as follows:
In doing this we now get the expected results:
For a full list of hexadecimal conversions visit http://ascii.cl/htmlcodes.htm.