| Index: src/json-stringifier.h
|
| diff --git a/src/json-stringifier.h b/src/json-stringifier.h
|
| index 05f4231f41ca62869049e7a708f35e0580953f87..8d53369f6ae3f75763ffc9b4e9cd10184d1fe55c 100644
|
| --- a/src/json-stringifier.h
|
| +++ b/src/json-stringifier.h
|
| @@ -198,7 +198,8 @@ BasicJsonStringifier::BasicJsonStringifier(Isolate* isolate, Handle<String> gap)
|
| stack_ = factory()->NewJSArray(8);
|
| int gap_length = gap->length();
|
| if (gap_length != 0) {
|
| - String::Flatten(gap);
|
| + gap = String::Flatten(gap);
|
| + if (gap->IsTwoByteRepresentation()) builder_.ChangeEncoding();
|
| DisallowHeapAllocation no_gc;
|
| String::FlatContent flat = gap->GetFlatContent();
|
| gap_ = NewArray<uc16>(gap_length + 1);
|
| @@ -206,7 +207,6 @@ BasicJsonStringifier::BasicJsonStringifier(Isolate* isolate, Handle<String> gap)
|
| CopyChars(gap_, flat.ToOneByteVector().start(), gap_length);
|
| } else {
|
| CopyChars(gap_, flat.ToUC16Vector().start(), gap_length);
|
| - builder_.ChangeEncoding();
|
| }
|
| gap_[gap_length] = '\0';
|
| } else {
|
|
|