JSON.parse method do not decode unicode \u characters < 32. Reproducible: Always Steps to Reproduce: <script type="text/javascript"> document.write(JSON.parse('"\\u0000"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0001"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0002"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0003"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0004"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0005"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0006"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0007"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0008"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0009"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u000a"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u000b"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u000c"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u000d"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u000e"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u000f"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0010"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0011"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0012"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0013"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0014"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0015"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0016"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0017"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0018"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u0019"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u001a"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u001b"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u001c"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u001d"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u001e"').charCodeAt()+'<br/>') document.write(JSON.parse('"\\u001f"').charCodeAt()+'<br/>') </script> Actual Results: [empty screen] Expected Results: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Firefox, Chrome, Opera, Explorer show numbers
Hm, yes looks like I misinterpreted the invalid characters part. U+0000 through U+001F is not allowed as char, but as escaped unicode sequence (ES5.1 15.12.1.1)
Git commit 0f0db01274fab4e4cfec1485776fbdf10065b5d7 by Bernd Buschinski. Committed on 10/09/2014 at 17:12. Pushed by buschinski into branch 'KDE/4.14'. kjs: U+0000 through U+001F is not allowed as char, but as escaped unicode sequence M +0 -5 kjs/jsonlexer.cpp http://commits.kde.org/kdelibs/0f0db01274fab4e4cfec1485776fbdf10065b5d7
Git commit 8d3db9eae95202906218239246aec324199b3c9d by Bernd Buschinski. Committed on 10/09/2014 at 17:14. Pushed by buschinski into branch 'master'. U+0000 through U+001F is not allowed as char, but as escaped unicode sequence M +0 -4 src/kjs/jsonlexer.cpp http://commits.kde.org/kjs/8d3db9eae95202906218239246aec324199b3c9d