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

Juha Manninen juha.manninen62 at gmail.com
Wed Mar 30 13:02:18 CEST 2016

On Wed, Mar 30, 2016 at 12:38 PM, Michael W. Vogel <m-w-vogel at gmx.de> wrote:
> With the hack that the LCL makes and the added {$codepage UTF8} all
> conversions work like a charm (see added testproject).

Conversions in your testproject may work, but you ignored the forum
link I gave earlier. There "malcome" gave examples that fail.
BTW, the hack is not made by LCL but by LazUtils which can be used
also with cmd line / server programs.

>> 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.
> I also don't want it. I want a added {$codepage UTF8}, if the file is saved
> as a UTF-8 encoded one.

The cases fail with UTF-8 file encoding.
All files created by Lazarus IDE are by default saved with UTF-8
encoding, thus you would get {$codepage UTF8} in every file which is
the same as -FcUTF8 for the whole project.
Adding -FcUTF8 is already extremely easy. There is a button for it in
Project Options -> Custom Options page.

The issue with constant string encodings is more complex than you seem
to understand.
It is explained here somehow:


More information about the Lazarus mailing list