[Lazarus] Feature Request: Insert {codepage UTF8} per default

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Mar 30 10:11:56 CEST 2016

> "Michael W. Vogel" <m-w-vogel at gmx.de> hat am 29. März 2016 um 23:20
> geschrieben:
>  I'm thinking about the thread here
> http://forum.lazarus.freepascal.org/index.php/topic,31939.msg206688.html#msg206688[...]
>  In the most cases the string magic works without a defined {$codepage utf8},
> but not if you want to assign a const to a Predefined String or Unicodestring.

You have to distinguish between with CP_UTF8 as default and with CP_ACP as
Both have cases where some string combinations fail.

LCL applications nowadays use CP_UTF8 as default. We (laz team) tested adding
-FcUTF8 and it failed in too many cases. Also it adds some overhead. So we
decided to *not* add it by default.

>  Offtopic: In the added project: Why is a const 'abc' with {$codepage UTF8} a
> Unicodestring (Windows7, 64bit, Lazarus 1.7 r52077M FPC 3.1.1
> i386-win32-win32/win64 on FPC 3.1.1 r33371)? 

There is no compile-time flag to tell the compiler what codepage the system is
using at runtime. So it assumes current Windows codepage. Any string literal not
in this codepage is stored as UTF-16.


More information about the Lazarus mailing list