[fpc-devel] XML and encoding problems

Alexander Todorov alexx.todorov at gmail.com
Fri Apr 21 15:49:45 CEST 2006

I am developing an application in Lazarus that is multi platform. It
has very strong usage of xml that contains contains cyrillic text
(Bulgarian language). All xml feeds are UTF-8 encoding and is
converted internaly using iconv (UTF-8 -> CP1251 and vice versa) when
needed. On Linux this is working very well, but on Windows it is not.
I have iconv.pas and link to iconv.dll but the problem is that when a
xml document is read from file / stream after that the contents of the
document are not UTF-8 encoded and iconv fails.
Attached is a simple program that reads a file and prints xml values.

On Linux the result is :
alex at optical:~/temp/utf$ ./project1
user=Тихомир Руменов Тотев

This is correct. Tested with gnome-terminal on native Linux system and
with Bitvise Tunelier ssh client for Windows.

On Windows the result is :
user=????N???????N? ?аN????╡?????? ????N??╡??

This is not correct. I tried debugging this but couldn't find the problem.
Compiled with Lazarus 0.9.14 / FPC 2.0.2.

Please give some help / hints / workaround. This is very cruical for me ATM.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: utf.tar.bz2
Type: application/x-bzip2
Size: 2511 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20060421/13046906/attachment.bin>

More information about the fpc-devel mailing list