Skip to content

Not processing "\u" characters in JSON String correctly.

Original Reporter info from Mantis: nicrosoft
  • Reporter name: Shen Min

Description:

The fpjson unit has a bug for processing "\u" characters in JSON String.

Steps to reproduce:

I have made a demo project to show the bug at:
https://github.com/shenmin/fpjson-bug-demo

The fpjson unit processes the "\u" characters in json string incorrect.

uses fpjson;

procedure TForm1.Button1Click(Sender : TObject);
var
    str : String;
    json : TJsonObject;
begin
    str := '{"name":"\u95e8\u88ab\u8111\u5b50\u6324\u574f\u4e86"}';
    json := GetJson(str) as TJsonObject;
    ShowMessage(json.Get('name', ''));
    json.Free;
end;

Mantis conversion info:

  • Mantis ID: 38618
  • Version: 2.0.12
  • Fixed in version: 3.3.1
  • Fixed in revision: 48965 (#0d1fb419)
  • Target version: 4.0.0
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information