@@ -246,7 +246,7 @@ begin
tkNull : NullValue;
tkTrue,
tkFalse : BooleanValue(t=tkTrue);
- tkString : if (joUTF8 in Options) and (DefaultSystemCodePage<>CP_UTF8) then
+ tkString : if ((joUTF8 in Options) or (DefaultSystemCodePage<>CP_UTF8)) and (TypeInfo(TJSONStringType) <> TypeInfo(UTF8String)) then
StringValue(TJSONStringType(UTF8Decode(CurrentTokenString)))
else
StringValue(CurrentTokenString);
@@ -525,8 +525,8 @@ begin
Inc(Rp, CodepointToASCII(cp, Rp));
end;
- if not utf8 then
- SetLength(FCurTokenString, Rp - PAnsiChar(Pointer(FCurTokenString)));
+ if utf8 then
+ SetCodePage(RawByteString(FCurTokenString), CP_UTF8, FALSE);
FPartsBytes := -1;