不解析jQuery.parseJSON \ u0092字符

我有一个用php编写的文本,带有一个带有de php utf8_encode的ajax函数。如果我直接在控制台中打印它,文本显示如下:

"projects":[ { "id": "1", "title": "CURSOS DE PERIODISME", "description": "Els cursos tenen l\u0092objectiu d\u0092aprofundir en l\u0092actitud period\u00edstica dels alumnes." } ] 

当我使用jquery.parseJSON并再次将文本打印到描述中时,文本解析如下:

Els cursos tenen lobjectiu daprofundirenuroitudperiperiísticadelumalumnes。

所有其他unicode字符都得到很好的解析,但为什么\ u0092没有被解析? 我做错了什么?

提前致谢!

U + 0092是一个控制字符,也许它正在被解析但你没有看到它,因为你正在使用字符串。

例如,此代码根本不进行JSON解析:

 (function() { var strWith = "Els cursos tenen l\u0092objectiu d\u0092aprofundir"; var strWithout = "Els cursos tenen lobjectiu daprofundir"; display("With (" + strWith.length + "): " + strWith); display("Without (" + strWithout.length + "): " + strWithout); function display(msg) { var p = document.createElement('pre'); p.innerHTML = String(msg); document.body.appendChild(p); } })(); 

实时复制 | 资源

输出:

 随着(40):Els cursos tenen lobjectiu daprofundir
没有(38):Els cursos tenen lobjectiu daprofundir 

正如您所看到的,它们在有和没有控制字符的情况下看起来相同,但我们可以从长度中看出控制字符包含在字符串中。

它由jQuery解析。 一个简单的测试可以告诉你:

 > $.parseJSON('"\\u0092"').length 1 > $.parseJSON('"\\u0092"').charCodeAt(0) 146 > $.parseJSON('"\\u0092"').charCodeAt(0).toString(16) "92" 

它只是不会显示,请参阅@TJCrowders的答案。