Being from a country that uses characters outside the ASCII range we are often times struggling with character set issues and today was no different. Well it was… Today I found the solution that has been eluding me for a long time.
We have been having issues with national characters in content being returned in AJAX calls for documents sent using the text/plain MIME-type (e.g. JSON). Apparently the XMLHTTPRequest used on most platforms assumes that the content it receives is in UTF-8 so if you’re having issues with encoding check the charset. Changing the character set in the servlet generating the data (Content-Type: text/plain;charset=UTF-8) and on the page (using a meta-tag) solved the issue.