Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with stringifying a JSON string consisting of Chinese characters #15

Open
MAC420965 opened this issue Nov 3, 2022 · 0 comments

Comments

@MAC420965
Copy link

The following code fails in a Delphi 11.1/Windows 64 Bit application with the conditional JSON_UTF8 defined in the Neslib.Json.* units:

program jsonwriter_err;

{$APPTYPE CONSOLE}

{$R *.res}

uses
System.SysUtils, Neslib.Json;

var
doc: IJsonDocument;
s1, s2: utf8string;

begin
s1 := '{"s":"クランクケース/全面カバー"}';
doc := TJsonDocument.Parse(s1);
s2 := doc.Root.ToJson(false);
WriteLn(Utf8ToString(s2));
ReadLn;
end.

Call stack:

:00007FFD1609CD29 ; C:\WINDOWS\System32\KERNELBASE.dll
System._RaiseAtExcept(???,???)
System.SysUtils.AssertErrorHandler('Assertion fehlgeschlagen','... Neslib.Json.IO.pas',1586,$712F5D)
System._Assert(???,???,???)
Neslib.Json.IO.TJsonWriter.WriteEscapedString('クランクケース/全面カバー')
Neslib.Json.IO.TJsonWriter.WriteString('クランクケース/全面カバー')
Neslib.Json.TJsonValue.WriteTo(TJsonWriter($258AEED80A0) as IJsonWriter)
Neslib.Json.TJsonValue.TJsonDictionary.WriteTo(TJsonWriter($258AEED80A0) as IJsonWriter)
Neslib.Json.TJsonValue.WriteTo(TJsonWriter($258AEED80A0) as IJsonWriter)
Neslib.Json.TJsonValue.ToJson(False)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant