[Lazarus] Windows and german Umlauts: why do i have to PWideChar(UTF8Decode(String)) and not UTF8ToAnsi(String)

Landmesser John jmlandmesser at gmx.de
Tue Oct 18 09:15:15 CEST 2016


I know how to deal with german Umlauts but I would like to understand.

Think of a  *.csv file that contains strings like "Grünberg" and that 
has to be opened in Excel ( Office 2003 ).

It works if i use PWideChar(UTF8Decode(String)). Got this tipp here in 
the mailinglist!

But  UTF8ToAnsi(String) fails.

Why is UTF8ToAnsi(String) not enough?

LHelp tells me about  UTF8ToAnsi():
"Utf8ToAnsi converts an utf8-encode unicode string to an ansistring. It 
converts the string to a widestring and then converts the widestring to 
an ansistring."

That is NOT  the same as  PWideChar(UTF8Decode(String))?

Tipps are welcome.

Thank you!!


More information about the Lazarus mailing list