解决IE8 内置JSON.stringify,中文变unicode的问题

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

// 把json对象转为json串code

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"}]}unicode

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

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

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

相关文章
相关标签/搜索