On Mon, 23 Nov 2015, Lubos Pintes wrote:
Hello,
Thanks for replies, I will try to explain this in other way:
My system code page is windows-1250. When a string is sent to a COM
component, it is somehow converted to UTF-16. Thus FPC knows how to do
the conversion. Now I know that I am receiving text in UTF-8. Thus I
called UTF8ToANSI to uselessly convert the UTF-8 to ANSI and then FPC
converted it to UTF-16 to make COM happy.
Do not convert to Ansi.
You should use unicodestring or widestring variables, and send that to COM.
Although it worked well in many cases, a data loss may occur.
So to reformulate this question, how to avoid this useless conversion
step? I thought that setting the default code page to UTF-8 just do the
trick.
COM only works with UTF16. The best way is to declare all strings that you
intend to send to COM to Widestring or UnicodeString.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal