When working with JSON containing Unicode text, I encountered an issue with the IE8 native json implementation.
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script>
var stringified = JSON.stringify("สวัสดี olé");
alert(stringified);
</script>
While using json2.js or FireFox's native JSON, the alert()
string remains unchanged. However, in IE8, the result is Unicode values instead of the original text:
\u0e2a\u0e27\u0e31\u0e2a\u0e14\u0e35 ol\u00e9
. Is there a simple way to make IE behave like other browsers, or to convert this string correctly? Do you consider this a bug in IE, given that native JSON implementations are meant to seamlessly replace json2.js?
Edit: A reproducible example on jsfiddle using the provided code - http://jsfiddle.net/vV4uz/