[Lazarus] UTF8 JSON library: was: UTF-8 XML

Reinier Olislagers reinierolislagers at gmail.com
Sun Jun 24 12:58:39 CEST 2012


(Cross-posted to Lazarus and FPC lists)

On the Lazarus list,
On 24-6-2012 10:17, Felipe Monteiro de Carvalho wrote:
> Hello,
> 
> I am using xmlread and dom from FPC to read a XML file and I got an
> unpleasant surprise.
> 
> It is converting things like this:
> 
> <mo>&#x00B1;<!-- ± --></mo>
> 
> Into:
> 
> <mo>±</mo>
> 
> But encoded in ISO 8859-1 which is awful as I don't want my program to
> go into the dark ages of pre-unicode and all problems it has.
> 
> I know that we have a XML reading library in Lazarus which uses UTF-8,
Related:

With the help of Ludo Brands - as usual ;) - I've converted the FPC
fpjson library to return UTF8 data.

I use it for my twitter/Oauthv1 library/program; you can find it
incorporated there at
https://bitbucket.org/reiniero/fpctwit/src
See e.g. fpjsonreadme.TXT
I've renamed the units so they shouldn't conflict with the FPC ones.

Note: I've only had to convert JSON strings to objects, not the other
way round; haven't tested that.
No idea whether the RTTI stuff works, haven't used it.

As usual, comments/patches welcome ;)

Thanks,
Reinier




More information about the Lazarus mailing list