mirror of
https://github.com/fangyidong/json-simple.git
synced 2025-12-06 15:30:54 +03:00
Add escaping for Unicode characters that cause problems for browser JS eval
This commit is contained in:
@@ -81,6 +81,15 @@ public class JSONObject extends HashMap{
|
|||||||
case '/':
|
case '/':
|
||||||
sb.append("\\/");
|
sb.append("\\/");
|
||||||
break;
|
break;
|
||||||
|
case '\u0085': // Next Line
|
||||||
|
sb.append("\\u0085");
|
||||||
|
break;
|
||||||
|
case '\u2028': // Line Separator
|
||||||
|
sb.append("\\u2028");
|
||||||
|
break;
|
||||||
|
case '\u2029': // Paragraph Separator
|
||||||
|
sb.append("\\u2029");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if(ch>='\u0000' && ch<='\u001F'){
|
if(ch>='\u0000' && ch<='\u001F'){
|
||||||
String ss=Integer.toHexString(ch);
|
String ss=Integer.toHexString(ch);
|
||||||
|
|||||||
Reference in New Issue
Block a user