惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
SecWiki News
SecWiki News
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
量子位
M
MIT News - Artificial intelligence
GbyAI
GbyAI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
TaoSecurity Blog
TaoSecurity Blog
博客园 - 【当耐特】
H
Heimdal Security Blog
腾讯CDC
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
S
Schneier on Security
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
博客园 - 司徒正美
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cybersecurity and Infrastructure Security Agency CISA
S
SegmentFault 最新的问题
大猫的无限游戏
大猫的无限游戏
Application and Cybersecurity Blog
Application and Cybersecurity Blog
F
Full Disclosure
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Threatpost
月光博客
月光博客
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
T
Troy Hunt's Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
D
DataBreaches.Net
O
OpenAI News
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
小众软件
小众软件
V
Vulnerabilities – Threatpost
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
T
The Exploit Database - CXSecurity.com
Martin Fowler
Martin Fowler
美团技术团队
P
Privacy International News Feed

博客园 - J-Pei

entity framework ConnectionString include password Microsoft Visual Studio无法启动程序进行调试的解决方法 通过Process调用桌面程序 深入理解Javascript闭包(closure) 安装SQL Server 2005过程出现错误:“SQL Server 服务无法启动”的解决办法 动态修改div的xy值 asp.net mvc 与jquery应用总结 Ajax 选项 这才是真正的JQuery.ajax传递中文参数的解决方法 ASP.NET MVC生命周期介绍(转) ASP.NET页生命周期介绍:阶段,事件及其他(转) JQuery 实现网页的快捷键操作 Meet Chirpy sybase性能调优 Entity FrameWork 4.1 RC 生成的sql语法性能存在问题 ADO.NET Entity FrameWork 4.1 RC 发布 asp.net MVC EF dynamic query 服务器返回json SQL SERVER 2008 MASTER数据库损坏修复
IE8下json.js 中文编码问题
J-Pei · 2011-04-04 · via 博客园 - J-Pei

原本需求是这样的:
有个AJAX的操作,需要传递表单数据,但是表单内容的name都是以answer[]命名,所以想把数据以为数组json化后传递 (用到了json2.js)

var answerStr = JSON.stringify(arr);

之前一直 跑得好好的,结果今天内务接到投诉电话,说试卷提交后答案全部乱码

如: “ u5c71u7f8a ”… 那边用google浏览器也是坏的,而我的google 又是好的,

后来到网上找了一下,原来出现错误是因为IE8内置有 JSON.parse()和JSON.stringify() 两个方法
而这和json2.js的方法重名

解决方法1:

 var answerStr = JSON.stringify(arr);   
 var o = JSON.parse( answerStr); 
 eval("var answerStr = '"+JSON.stringify(o)+"';");    //这是中文的ASCII码,利用eval转换

解决办法2:把Json2.js里的JSON改下名称,改成JSON2,这样调用:JSON2.stringify();