@@ -118,8 +118,8 @@ static void convert_UTF8_to_JSON(FBuffer *out_buffer, VALUE str, const char esca
118
118
case '\r' : fbuffer_append (out_buffer , "\\r" , 2 ); break ;
119
119
case '\t' : fbuffer_append (out_buffer , "\\t" , 2 ); break ;
120
120
default : {
121
- scratch [2 ] = hexdig [ ch >> 12 ] ;
122
- scratch [3 ] = hexdig [( ch >> 8 ) & 0xf ] ;
121
+ scratch [2 ] = '0' ;
122
+ scratch [3 ] = '0' ;
123
123
scratch [4 ] = hexdig [(ch >> 4 ) & 0xf ];
124
124
scratch [5 ] = hexdig [ch & 0xf ];
125
125
fbuffer_append (out_buffer , scratch , 6 );
@@ -240,8 +240,8 @@ static void convert_ASCII_to_JSON(FBuffer *out_buffer, VALUE str, const char esc
240
240
case '\r' : fbuffer_append (out_buffer , "\\r" , 2 ); break ;
241
241
case '\t' : fbuffer_append (out_buffer , "\\t" , 2 ); break ;
242
242
default :
243
- scratch [2 ] = hexdig [ ch >> 12 ] ;
244
- scratch [3 ] = hexdig [( ch >> 8 ) & 0xf ] ;
243
+ scratch [2 ] = '0' ;
244
+ scratch [3 ] = '0' ;
245
245
scratch [4 ] = hexdig [(ch >> 4 ) & 0xf ];
246
246
scratch [5 ] = hexdig [ch & 0xf ];
247
247
fbuffer_append (out_buffer , scratch , 6 );
@@ -288,8 +288,8 @@ static void convert_UTF8_to_ASCII_only_JSON(FBuffer *out_buffer, VALUE str, cons
288
288
case '\r' : fbuffer_append (out_buffer , "\\r" , 2 ); break ;
289
289
case '\t' : fbuffer_append (out_buffer , "\\t" , 2 ); break ;
290
290
default : {
291
- scratch [2 ] = hexdig [ ch >> 12 ] ;
292
- scratch [3 ] = hexdig [( ch >> 8 ) & 0xf ] ;
291
+ scratch [2 ] = '0' ;
292
+ scratch [3 ] = '0' ;
293
293
scratch [4 ] = hexdig [(ch >> 4 ) & 0xf ];
294
294
scratch [5 ] = hexdig [ch & 0xf ];
295
295
fbuffer_append (out_buffer , scratch , 6 );
0 commit comments