转自:
http://my.oschina.net/u/919074/blog/191131

项目中出现在IE下出现把json对象转为json串中文变成unicode的问题,最后经过排查,发现是IE8内置JSON.stringify()引起的,解决方法如下:

// 把json对象转为json串

var policy_content = JSON.stringify(data.jsonObject);

policy_content={policy":[{"name":"must_installed","enabled":1,"key_check":1,"content":{"must_installed_list":["\u641c\u72d7"]},"desc":"\u5fc5\u987b\u5b89\u88c5\u8f6f\u4ef6"}]}

// 利用JS再做了一层解析,把unicode又变成中文。

eval(" var g_policy = '"+policy_content+"';");

g_policy=={policy":[{"name":"must_installed","enabled":1,"key_check":1,"content":{"must_installed_list":["搜狗"]},"desc":"必须安装软件"}]}

相关文章:

  • 2022-01-11
  • 2021-09-09
  • 2022-12-23
  • 2021-06-20
猜你喜欢
  • 2021-04-10
  • 2022-12-23
  • 2021-10-25
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案