Consider the following user input via a textarea:
This contains the following bytes:
0x61 0x0A 0x62 0x0A 0x62
BUT, when I run this string through JSON.stringigy, I find that the newline characters (0x0A) have been replaced by their unicode equivalent, which is \u000a
My server-side script uses utf-8 encoding, so of course it doesn't convert \u000a back to 0x0A correctly.
How can I force JSON to encode newlines (and other backslash-escaped characters) using utf-8, rather than unicode?
I currently have a hack in my server-side script to do the conversion, but I'm not happy about that!