[Lazarus] UTF8String and UTF8Delete

Sven Barth pascaldragon at googlemail.com
Fri Dec 11 19:14:43 CET 2015


On 11.12.2015 15:20, "Jürgen Hestermann" wrote:
>  >My link explains some differences important for Lazarus.
> But it does not explain the difference between an "UTF8String" and an
> "UTF8 String"
>  >The encoding hassle is built into Windows. The compiler cannot overcome
>  >it. It can only give you tools to make it easier.
> That is not true.
> Windows uses 2 kinds of strings: ANSI (one byte) and/or UTF16 (2 byte).
> None of them can be used with UTF8 functions so a conversion is needed
> anyway.

This is not entirely correct. 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.

Regards,
Sven





More information about the Lazarus mailing list