File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -64,8 +64,8 @@ unsigned escapeControls(String& value, Options options)
6464 } else if (uint8_t (c) < 0x20 ) {
6565 extra += 3 ; // "\xnn"
6666 } else if ((c & 0x80 ) && options[Option::utf8]) {
67- // Characters such as £ (0xa3) are escaped to 0xc2 0xa3 in UTF-8
68- extra += 1 ; // 0xc2
67+ // Characters from U+0080 to U+07FF are encoded in two bytes in UTF-8
68+ extra += 1 ;
6969 }
7070 }
7171 if (extra == 0 ) {
@@ -100,7 +100,8 @@ unsigned escapeControls(String& value, Options options)
100100 *out++ = hexchar (uint8_t (c) >> 4 );
101101 c = hexchar (uint8_t (c) & 0x0f );
102102 } else if ((c & 0x80 ) && options[Option::utf8]) {
103- *out++ = 0xc2 ;
103+ *out++ = 0xc0 | (c >> 6 );
104+ c = 0x80 | (c & 0x3f );
104105 }
105106 *out++ = c;
106107 }
You can’t perform that action at this time.
0 commit comments