1

When using boost::property_tree::write_json() to write a JSON file, all unicode characters will be represented as two "/u"-code points.

  • So ä will become \u00C3\u00A4.

My problem is, that I am generating a JSON file which will be read via JQuery to be shown in a web page. In that case, this pair will be shown as two separated unicode symbols.

  • So ä looks like ä

Is there a way to configure the output encoding to get a single Utf16 code point? Or is there a way to tell jQuery to use both code-points as one?

Also, why is ä becoming \u00C3\u00A4 instead of \u00E4? I really don't get it.

Thanks for help!

4

1 回答 1

1

那是因为它被编码为“UTF-8”,如果输出出现这样的错误,那是因为它被编码了两次,或者因为它没有被“理解”为 UTF-8。这可能是因为网页没有正确设置为“使用 UTF-8”。您在页面上的标题将需要具有Content-Type: text/html; charset=utf-8或类似的东西。

于 2013-09-04T10:19:46.520 回答