Recent

Author Topic: FPJson and UTF-8  (Read 232 times)

Amir61

  • New Member
  • *
  • Posts: 49
    • http://Amir.Aavani.net
FPJson and UTF-8
« on: May 29, 2026, 07:48:14 pm »
Hi,

I am trying to parse jsonl file containing UTF-8 strings and noticing FPJson removing some bytes from the values. Is this a known issue?
I attached a simple example.

paweld

  • Hero Member
  • *****
  • Posts: 1638
Re: FPJson and UTF-8
« Reply #1 on: May 29, 2026, 08:07:20 pm »
Which version of FPC?
Everything works correctly in version 3.2-fixes.
Best regards / Pozdrawiam
paweld

Amir61

  • New Member
  • *
  • Posts: 49
    • http://Amir.Aavani.net
Re: FPJson and UTF-8
« Reply #2 on: May 29, 2026, 08:19:45 pm »
I am using $ fpc
Free Pascal Compiler version 3.2.2 [2024/09/11] for aarch64


ALLIGATOR

  • Sr. Member
  • ****
  • Posts: 434
  • I use FPC [main] 💪🐯💪
Re: FPJson and UTF-8
« Reply #3 on: May 30, 2026, 05:20:52 am »
FPC [git main]:

Code: Pascal  [Select][+][-]
  1. === Testing fpjson UTF-8 Handling ===
  2.  
  3. Original JSON bytes: 7B 22 76 65 6E 75 65 22 3A 20 22 43 C2 B3 50 22 2C 20 22 74 69 74 6C 65 22 3A 20 22 54 65 73 74 22 7D
  4.  
  5. Venue in JSON (20 bytes from "venue"): 22 76 65 6E 75 65 22 3A 20 22 43 C2 B3 50 22 2C 20 22 74 69
  6.  
  7. Parsing JSON with fpjson...
  8. fpjson returned venue: "CВ?P" bytes: 43 C2 B3 50
  9.  
  10. Expected: 43 C2 B3 50  (C + C2B3 [┬│] + P)
  11. If bug exists, fpjson drops C2, leaving: 43 B3 50
  12.  
  13. No bug: fpjson correctly preserved all UTF-8 bytes
I may seem rude - please don't take it personally

Amir61

  • New Member
  • *
  • Posts: 49
    • http://Amir.Aavani.net
Re: FPJson and UTF-8
« Reply #4 on: May 30, 2026, 05:24:07 am »
Yes! I can confirm it works fine with the newer version (including fpc built form git).


 

TinyPortal © 2005-2018