[Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers
Michael Van Canneyt
michael at freepascal.org
Fri Aug 30 16:04:47 CEST 2019
On Fri, 30 Aug 2019, Anthony Walter via lazarus wrote:
> On my system with FPJson the test is failing it failing on "bank teller
> \u00Ae ", but on when using approximately the same code with JSONTools it
> passes on both "name" and "occupation" always. What do you think is going
> on?
No idea. I tested with both 3.0.4 and trunk. Both give the same result.
Here are the sources I used:
home:~/fpc/packages/fcl-json/tests> cat twalter.pas
program twalter;
{$codepage UTF8}
uses cwstring, fpjson, jsonparser;
function VerifyUnicodeChars: Boolean;
const
UnicodeChars = '{ "name": "Joe®Schmoe", "occupation": "bank teller \u00Ae " }';
var
N: TJSONData;
begin
N := GetJSON(UnicodeChars);
Writeln('>',UnicodeChars,'<');
Result := (N.Items[0].AsUnicodeString = 'Joe®Schmoe') and
(N.Items[1].AsUnicodeString = 'bank teller ® ');
N.Free;
end;
begin
WriteLn('Handles unicode chars correctly: ', VerifyUnicodeChars);
end.
I test on linux, but could try windows.
Michael.
More information about the lazarus
mailing list