In an external javascript file I have a function that is used to append text to table cells (within the HTML doc that the javascript file is added to), text that can sometimes have Finnish characters (such as ä). That text is passed as an argument to my function:
content += addTableField(XML, 'Käyttötarkoitus', 'purpose', 255);
The problem is that diacritics such as “ä” get converted to some other bogus characters, such as “�”. I see this when viewing the HTML doc in a browser. This is obviously not desirable, and is quite strange as well since the character encoding for the HTML doc is UTF-8.
How can I solve this problem?
Thanks in advance for helping out!
The file that contains
content += addTableField(XML, 'Käyttötarkoitus', 'purpose', 255);is not saved in UTF-8 encoding.I don’t know what editor you are using but you can find it in settings or in the save dialog.
Example:
If you can’t get this to work you could always write out the literal code points in javascript:
credit: triplee