I have a text encoded from php with an ajax function with de php utf8_encode.If I print it in the console directly the text is displayed as follows :
\"proj
It is parsed by jQuery. A simple test can show you:
> $.parseJSON('"\\u0092"').length
1
> $.parseJSON('"\\u0092"').charCodeAt(0)
146
> $.parseJSON('"\\u0092"').charCodeAt(0).toString(16)
"92"
It only won't get displayed, see @TJCrowders answer for that.
U+0092 is a control character, perhaps it's being parsed but you're not seeing it because of how you're using the string.
For example, this code which does no JSON parsing at all:
(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);
}
})();
Live copy | source
Output:
With (40): Els cursos tenen lobjectiu daprofundir Without (38): Els cursos tenen lobjectiu daprofundir
As you can see, they look the same with and without the control character, but we can see from the lengths that the control character is included in the string.