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

UTF8 Error #33

Closed
lynch9983 opened this issue Oct 25, 2016 · 4 comments
Closed

UTF8 Error #33

lynch9983 opened this issue Oct 25, 2016 · 4 comments
Assignees

Comments

@lynch9983
Copy link

lynch9983 commented Oct 25, 2016

When I use JsonDataObjects,pas (in Delphi XE) like this:

procedure doParseUTF8();
var
aJson: TJsonObject;
aJsonStr: string;
aUTF8Str: UTF8String;
begin
aJsonStr := '{"123":{"abc":{"efg":"hij"}}}';
aUTF8Str := UTF8Encode(aJsonStr);

aJson := TJsonObject.Create;
try
aJson.FromUtf8JSON(aUTF8Str);
ShowMessage(aJson.ToJSON);
finally
aJson.Free;
end;
end;

I get message '{"12":{"ab":{"ef":"hi"}}}'.
The Key and The Value all have been cut.

this Error also in parse from UTF8 file.

@ahausladen
Copy link
Owner

I can't reproduce this behavior if I run your code (neither in XE nor in 10.1). Did you use the newest source code?

@ahausladen ahausladen self-assigned this Oct 25, 2016
@lynch9983
Copy link
Author

lynch9983 commented Oct 26, 2016

JsonUTF8.zip
This is all my test codes ( in XE ).

And, if I edit the procedure

" TUtf8JsonReader.LexString"

line 5759: SetStringUtf8(FLook.S, P, EndP - P) // before edit

to

line 5759: SetStringUtf8(FLook.S, P, EndP - P + 1) //after edit

after edit, my test run ok.

@ahausladen
Copy link
Owner

Do you have XE Update 1 installed? I have and I don't see that bug with your test application. The only thing that could be different is Utf8ToUnicode.

@lynch9983
Copy link
Author

I run it in XE( with Update 1 ), the demo run OK.
I'm sorry to bother you.

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

2 participants