Jump to content

David Robb

Members
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. David Robb

    FloatToJSON

    Thank you everybody for the replies. Believe it or not I couldn't remember where the current iteration of the quality portal was since my computer died :). Bookmarked! I don't think this is a serious issue; maybe it's not an issue at all. If we follow the robustness principle we'll be liberal in what we accept and conservative in what we emit. And if your JSON parser can't handle a ".0" in a currency/float value you've got some big problems. Marco's comment in issue [RSP-36188] Adding isDouble() function in TJSONNumber - Embarcadero Technologies is interesting: Sync status from internal system, internal issue closed on Feb 16, 2023 by Marco Cantù with comment: JavaScript and .NET/JSON implementation don't force add ".0" part for floating-point data. Only Python goes in that direction...
  2. David Robb

    FloatToJSON

    Hello Delphi-Praxis! I discovered a change to System.JSON as compared to Rio/Sydney: function FloatToJson(const Value: Extended): string; var Buffer: array[0..63] of Char; L: Integer; begin L := FloatToText(Buffer, Value, fvExtended, ffGeneral, 17, 0, JSONFormatSettings); Buffer[L] := #0; if (StrScan(Buffer, '.') = nil) and (StrScan(Buffer, 'E') = nil) and not (Value.SpecialType in [fsInf, fsNInf, fsNaN]) then begin Buffer[L] := '.'; Buffer[L + 1] := '0'; Inc(L, 2); end; SetString(Result, Buffer, L); end; We are appending ".0" to all extended values if FloatToText doesn't do that. This causes Currency values to be formatted as e.g. "3.0" instead of "3". Should I report this to QC?
  3. David Robb

    Advice for Compiling Github Indy under Delphi 12

    Thank you for your response, Remy, I will download that PR!
  4. In case anybody had trouble getting the Indy packages to compile, note that there is a copy of IdCompilerDefines.inc in Lib\Core, Lib\System and Lib\Protocols and each one needs to be edited by adding the following below the VER350 compiler define: //Delphi & CBuilder 12.0 Athens {$IFDEF VER360} {$DEFINE VCL_11} {$IFDEF CBUILDER} {$DEFINE CBUILDER_12} {$ELSE} {$DEFINE DELPHI_12} {$ENDIF} {$ENDIF}
×