[Lazarus] UTF8String and UTF8Delete

Jürgen Hestermann juergen.hestermann at gmx.de
Sat Dec 12 12:46:59 CET 2015


Am 2015-12-11 um 19:14 schrieb Sven Barth:
 > Windows uses multi byte strings (one byte per character or more)
 > and UTF-16 (which is mostly 2 Byte and 4 for surrogate pairs).
 > The functions WideCharToMultiByte and MultiByteToWideChar which
 > are also used inside FPC for string conversions both take a
 > CodePage parameter that can also be CP_UTF8.

As far as I know, (current) Windows versions only use UTF16 internally.
But it provides the old legacy ANSI functions too (which convert to UTF16).
MultiByteToWideChar and WideCharToMultiByte are just helper
functions to convert from arbitrary encodings to UTF16 (and back).
But UTF-8 is nowhere used internaly in Windows (not even ANSI anymore,
except the legacy functions which convert to and from UTF16) and
you cannot use UTF8 as string encoding for WIN API functions.
Otherwise we would not have this problem and could use UTF-8 as
a standard for everything.




More information about the Lazarus mailing list