File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/bytes Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -246,9 +246,10 @@ public static byte[] unicodeEscape(String str) {
246
246
// ('\U00xxxxxx')
247
247
byte [] bytes = new byte [str .length () * 10 ];
248
248
int j = 0 ;
249
- for (int i = 0 ; i < str .length (); i ++ ) {
249
+ for (int i = 0 ; i < str .length ();) {
250
250
int ch = str .codePointAt (i );
251
251
j = unicodeEscape (ch , j , bytes );
252
+ i += Character .charCount (ch );
252
253
}
253
254
bytes = Arrays .copyOf (bytes , j );
254
255
return bytes ;
@@ -258,9 +259,10 @@ public static byte[] unicodeEscape(String str) {
258
259
public static byte [] unicodeNonAsciiEscape (String str ) {
259
260
byte [] bytes = new byte [str .length () * 10 ];
260
261
int j = 0 ;
261
- for (int i = 0 ; i < str .length (); i ++ ) {
262
+ for (int i = 0 ; i < str .length ();) {
262
263
int ch = str .codePointAt (i );
263
264
j = unicodeNonAsciiEscape (ch , j , bytes );
265
+ i += Character .charCount (ch );
264
266
}
265
267
bytes = Arrays .copyOf (bytes , j );
266
268
return bytes ;
You can’t perform that action at this time.
0 commit comments