Recent

Author Topic: LAMW json utf-8 problem  (Read 760 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2001
    • Lazarus and Free Pascal italian community
LAMW json utf-8 problem
« on: November 15, 2019, 11:43:33 am »
Hi guys, I have a problem with manipulating JSONs in android. I practically lose support for utf8. I don't understand why. I gave an example. Just press the button and you will see that the first showmessage correctly displays the values. While the following showmessages when they have to display the name I get the wrong value. I don't understand why. Ideas?
« Last Edit: November 15, 2019, 12:30:26 pm by xinyiman »
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

A.S.

  • Jr. Member
  • **
  • Posts: 76
Re: LAMW json utf-8 problem
« Reply #1 on: November 16, 2019, 08:47:34 pm »
I think you have a problem in source (see attached picture -- from Lazarus IDE Source Editor)

xinyiman

  • Hero Member
  • *****
  • Posts: 2001
    • Lazarus and Free Pascal italian community
Re: LAMW json utf-8 problem
« Reply #2 on: November 17, 2019, 01:54:34 pm »
I don't understand what the problem is in the source. The string displays it correctly with the first showmessage. The problem is later.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

xinyiman

  • Hero Member
  • *****
  • Posts: 2001
    • Lazarus and Free Pascal italian community
Re: LAMW json utf-8 problem
« Reply #3 on: November 18, 2019, 12:27:36 pm »
No suggestion?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

xinyiman

  • Hero Member
  • *****
  • Posts: 2001
    • Lazarus and Free Pascal italian community
Re: LAMW json utf-8 problem
« Reply #4 on: November 19, 2019, 11:07:28 am »
Solved, it was enough to add the LazUtils requirement and in the controls.lpr file put the LazUTF8 unit. I foolishly did tests on a Mac with a newer version of FPC than the one that uses LAMW on ubuntu. Arcanum solved.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1