JSON-Viewer
JSON-Viewer copied to clipboard
Format JSON replaces unicode characters code with the actual unicode character
When I have
{"FreeTextInput":"\u003Cscript\u003Ealert(\u0022links\u0022);\u003C/script\u003E"}
in a Notepad++ editor tab, select the text and apply menu Plugins - JSON Viewer - format JSON, the result is:
{
"FreeTextInput": "<script>alert(\"links\");</script>"
}
I am not sure if this is by design, but I surely surprised me.
If doesn't matter if the Encoding is set to ANSI or to UTF-8.
The bug is that "Format Json" is unescaping the escaped characters / and u**** in strings, instead of leaving them in the original escaped form. The escaped characters \ plus ", , b, f, n, r, or t don't change. Maybe it is related to the fact that those characters need to be escaped too in c++, while / doesn't?
现在的文件都是默认的utf-8 ,打开后中文乱码显示为ansi