Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2014-09

ReadXMLFile in fcl-xml package

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

LacaK

Hi,
I use ReadXMLFile from fcl-xml package to read XML file in UTF-8 encoding. Then I parse Nodes and use TextContent property which is string in system encoding ... but I need it in UTF-8 encoding. So I use again UTF8Encode(Node.TextContent).
Is there any SIMPLE way how to say that ReadXMLFile should not perform translation from UTF-8 to system encoding?
(may be somehow with custom TDecoder or so ... or use Laz_ versions or ...?) Thanks
-Laco.

Reply by email

Mattias Gaertner
to LacaK
Show quoted text 8 lines
Hi, I use ReadXMLFile from fcl-xml package to read XML file in UTF-8 encoding. Then I parse Nodes and use TextContent property which is string in system encoding ... but I need it in UTF-8 encoding. So I use again UTF8Encode(Node.TextContent). Is there any SIMPLE way how to say that ReadXMLFile should not perform translation from UTF-8 to system encoding? (may be somehow with custom TDecoder or so ... or use Laz_ versions or ...?)

The Lazarus sources contain units to read/write XML using UTF8 strings. The units are based on the fcl-xml units. The widestrings were replaced with UTF8 Ansistrings. lazarus/components/lazutils/laz2_xml*. The units work standalone. You don't need Lazarus for them.

Mattias

Reply by email