开发者

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

开发者 https://www.devze.com 2023-01-24 22:41 出处:网络
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\". S

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

精彩评论

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