You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In accordance with the specifications of JSON (see http://www.json.org/), about Number type.
Number is:
It is a double precision floating-point format in JavaScript (Octal and hexadecimal formats are not used).
...
In accordance with the definition, the DOT (".") must be used as the decimal separator. In your implementation of JSON (in flcJson.pas), you use FloatToStr and StrToFloat function, which as a decimal value used Delphi DecimalSeparator global constant, which contradicts the requirements of the JSON specification. For example, in Russia as DecjmalSeparator used COMMA, therefore your flcJson module in Russia can not be used.
In accordance with the foregoing, I propose:
Into flcJson.pas module add two functions:
function FloatToStrDot (aValue: extended): string;
var
fFormatSettings : TFormatSettings;
begin
GetLocaleFormatSettings (GetThreadLocale, fFormatSettings);
fFormatSettings.DecimalSeparator := '.';
Result := FloatToStr (aValue, fFormatSettings);
end;
function StrToFloatDot (aValue : string) : Extended;
var
fDummy : Integer;
begin
Val(aValue, Result, fDummy);
if fDummy <> 0 then
raise Exception.CreateFmt('Invalid float value: "%s"', [aValue]);
end;
Using the above-mentioned functions in all flcJson.pas module instead
FloatToStr and StrToFloat.
Regards,
Malinovsky Vladimir.
The text was updated successfully, but these errors were encountered:
Hello!
In advance, sorry for my poor english.
In accordance with the specifications of JSON (see http://www.json.org/), about Number type.
Number is:
It is a double precision floating-point format in JavaScript (Octal and hexadecimal formats are not used).
...
In accordance with the definition, the DOT (".") must be used as the decimal separator. In your implementation of JSON (in flcJson.pas), you use FloatToStr and StrToFloat function, which as a decimal value used Delphi DecimalSeparator global constant, which contradicts the requirements of the JSON specification. For example, in Russia as DecjmalSeparator used COMMA, therefore your flcJson module in Russia can not be used.
In accordance with the foregoing, I propose:
FloatToStr and StrToFloat.
The text was updated successfully, but these errors were encountered: