开发者

jquery: how to decode the stringized utf-8 character?

My python se开发者_开发百科rver uses json.dumps() to dump the json object into the string, but it also converts the binary utf-8 code which is not ascii, into the stringized thing, like "\u4e2d". So what my client see is this string, is there any api to convert "\u4e2d" back to utf-8 character?


In jQuery you can use $.parseJSON to decode a JSON-formatted object. That includes decoding encoded characters. Using dataType: 'json' with $.ajax (or $.post) or using $.getJSON will do that for you if you are trying to make AJAX requests.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜