[Lazarus] UTF8 RTL for Windows

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Nov 22 23:38:29 CET 2014


On Sat, 22 Nov 2014 17:18:35 +0100
Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:

> Mattias Gaertner schrieb:
> 
> >   // GetCommandLineW returns a UTF-16 PWideChar
> >   // the compiler adds code to convert this to the
> >   // default system codepage (CP_ACP = CP_UTF8)
> >   // the resulting string has StringCodePage CP_ACP
> >   // and is encoded in UTF-8.
> 
> Does this mean that Lazarus (new mode) ignores the OS system codepage 
> setting?

To be exact:
Lazarus unit fpcadds sets the default string encoding
(DefaultSystemCodePage) to CP_UTF8. The OS system codepage of
Windows is not changed. All non "W" (e.g. "A") functions still return
and expect strings in the Windows system codepage.
You can convert between UTF8 and Windows system codepage with
UTF8ToWinCP and WinCPToUTF8.

So, yes, a LCL application can now mostly ignore the system codepage.
Finding the exceptions and traps is the goal of this mail thread.

Please test and report what you find out.

Mattias




More information about the Lazarus mailing list