[Lazarus] Making sources compatible with Delphi (but Lazarus is priority)

Ondrej Pokorny lazarus at kluug.net
Fri May 5 13:41:26 CEST 2017


On 05.05.2017 13:02, Graeme Geldenhuys via Lazarus wrote:
> On 2017-05-05 10:41, Ondrej Pokorny via Lazarus wrote:
>> Just use "DefaultSystemCodePage := CP_UTF8" and every single-byte string
>> is unicode enabled.
> So does that mean you don't have to also call the following two functions (which LCL does).
>
>   SetMultiByteConversionCodePage(CP_UTF8);
>   SetMultiByteRTLFileSystemCodePage(CP_UTF8);
>
>
> So doing
>
>     DefaultSystemCodePage := CP_UTF8;
>
> is all you need to switch the RTL, FCL and the String data type to UTF-8?
>
> If so, when why does LCL also call the above two functions?

SetMultiByteConversionCodePage does only one thing: it sets 
DefaultSystemCodePage :) So yes, if you set DefaultSystemCodePage you 
don't have to call SetMultiByteConversionCodePage.

You are right - I forgot about 
SetMultiByteRTLFileSystemCodePage/DefaultRTLFileSystemCodePage.

BUT if I take a look into the RTL sources I see that it's used only in 
FindFirst/FindNext, FExpand and GetDir/do_GetDir. And only in the result 
strings. IMO it could be removed and replaced with DefaultSystemCodePage.

Ondrej


More information about the Lazarus mailing list