I'm writing a JS that run using windows cscript.exe
.
My JS is loading JSON object from file, adds a parameter and saves it back to file (using json2.min.js implementation).
I'm using JSON.parse(text)
to parse the text into JSON object, and then JSON.stringify(text, null, 3)
to create the string that I'm writing back. Everything works great until I encounter Unicode encoding.
In the file there are certain values such as
"someKey": "\u003Ca href=\"http://www.something.com\"\u003E"
that after I read and save back to file (stringify
) are changed into:
"someKey": "< a href=\"http://www.something.com\">
There are a few other foreign Unicode characters that are converted.
How can I keep the original encoding when I perform stringify
?
Is there any conversion function that I can use during stringify
or apply after?