[fpc-pascal] JSONStringToString question
Bart
bartjunk64 at gmail.com
Sat Mar 13 18:58:44 CET 2021
>From : https://www.freepascal.org/docs-html/current/fcl/fpjson/jsonstringtostring.html
Function result
Pascal string with escaped characters replaced
{$mode objfpc}
{$h+}
uses
fpjson;
var
S1, S2: TJSONStringType;
begin
repeat
write('S: ');readln(S2);
S1 := JSONStringToString(S2);
writeln(S1);
until S2='';
end.
C:\Users\Bart\LazarusProjecten\ConsoleProjecten>fpc test.pas
Free Pascal Compiler version 3.2.0 [2020/06/04] for i386
Copyright (c) 1993-2020 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling test.pas
Linking test.exe
15 lines compiled, 0.2 sec, 233536 bytes code, 10196 bytes data
C:\Users\Bart\LazarusProjecten\ConsoleProjecten>test
S: \u0041\
A (as expected)
S: \u0042
B (as expected)
S: \"\u0041\
"A (as expected)
S: \"\u0041\"
"A" (as expected)
S: \u0041\u0042
AAB (Huh??)
Do I misunderstand the purpose of this function or is this a bug?
--
Bart
More information about the fpc-pascal
mailing list