开发者

JSON getting "name":"\u05d7\u05d1\u05e8\u05d4" for non-English

开发者 https://www.devze.com 2023-03-20 03:50 出处:网络
I am 开发者_JAVA百科getting a JSON returned by Ajax from PHP json_encode I have a Hebrew characters that turned into \"\\u05d7\\u05d1\\u05e8\\u05d4\"

I am 开发者_JAVA百科getting a JSON returned by Ajax from PHP json_encode I have a Hebrew characters that turned into "\u05d7\u05d1\u05e8\u05d4"

How can I turn them back into Hebrew?

(The DB is encoded UTF8 and when calling the PHP file the Hebrew is displayed correctly)


You use any (non-broken) JSON parser.


As Quentin pointed out, this is correct. \uXXXX is a correct escape sequence for a unicode character. In fact, if you type in into the firebug console, it will prompt you "חברה". That does look hebrew to me, although I can't tell whether it's correct.

Therefore after parsing the data you received (either with eval or JSON.parse) the character should be unescaped automatically.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号