File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
src/com/adobe/serialization/json Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -164,17 +164,18 @@ package com.adobe.serialization.json
164164 default : // everything else
165165
166166 // check for a control character and escape as unicode
167- if ( ch < ' ' )
168- {
167+ if ( ch < ' ' || ch > '}' ) {
169168 // get the hex digit(s) of the character (either 1 or 2 digits)
170169 var hexCode: String = ch. charCodeAt ( 0 ). toString ( 16 );
171170
172171 // ensure that there are 4 digits by adjusting
173172 // the # of zeros accordingly.
174- var zeroPad: String = hexCode. length == 2 ? "00" : "000" ;
173+ while ( hexCode. length < 4 ) {
174+ hexCode = "0" + hexCode;
175+ }
175176
176177 // create the unicode escape sequence with 4 hex digits
177- s += "\\ u" + zeroPad + hexCode;
178+ s += "\\ u" + hexCode;
178179 }
179180 else
180181 {
You can’t perform that action at this time.
0 commit comments