【问题标题】:jquery: how to decode the stringized utf-8 character?jquery:如何解码字符串化的 utf-8 字符?
【发布时间】:2010-11-15 12:15:28
【问题描述】:

我的 python 服务器使用 json.dumps() 将 json 对象转储到字符串中,但它也将不是 ascii 的二进制 utf-8 代码转换为字符串化的东西,如“\u4e2d”。那么我的客户看到的是这个字符串,是否有任何 api 可以将“\u4e2d”转换回 utf-8 字符?

【问题讨论】:

    标签: javascript jquery python


    【解决方案1】:

    在 jQuery 中,您可以使用 $.parseJSON 来解码 JSON 格式的对象。这包括解码编码字符。如果您尝试发出 AJAX 请求,则使用 dataType: 'json'$.ajax(或 $.post)或使用 $.getJSON 将为您做到这一点。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-05-09
      • 2022-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-15
      • 2014-04-23
      相关资源
      最近更新 更多