[Lazarus] Using fcl-xml with lcl and constant Utf8Encode/Decode conversion

Mattias Gaertner nc-gaertnma at netcologne.de
Wed May 12 22:03:38 CEST 2010


On Mon, 10 May 2010 19:15:31 +0500
Vladimir Zhirov <vvzh.lists at gmail.com> wrote:

> Hi,
> 
> I used to process XML files in my Lazarus applications using SimpleXML
> library for Delphi. Recently I tried to switch to fcl-xml (because of
> better performance) and faced with the following problem.
> 
> Since LCL uses utf-8 as internal string encoding, I use it for all
> string data in my applications too. But DOM/XMLRead/XMLWrite units use
> usc-2/utf-16 (WideString) so when working with TXmlDocument I have
> to do conversion like this:
> 
> myUtf8String := UTF8Encode(myElement['name']);
> myElement['name'] := UTF8Decode(myString);
> 
> What I would like is to get rid of UTF8Encode/UTF8Decode stuff in my
> source. I guess CodeTools uses modified fcl-xml units to achieve exactly
> that, but these units seem to be pretty outdated compared to recent
> fcl-xml version in FPC 2.4.0.

I uploaded updated versions in revision 25343. See
components/codetools/laz2_*.pas

Can you test them?

When they work they can replace the old units.

Mattias




More information about the Lazarus mailing list