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

Juha Manninen juha.manninen62 at gmail.com
Thu Mar 31 17:04:22 CEST 2016

On Thu, Mar 31, 2016 at 5:20 PM, Bart <bartjunk64 at gmail.com> wrote:
> In my fantasy scenario the String would of course have the meaning of
> UnicodeString.

That is not anyhow better (or worse) inherently than a UTF-8 based solution.
Delphi just happened to implement it so, for various reasons.
The surprise is that our system is so Delphi compatible even while
having a different encoding.

> The tests I posted in this thread were plain fpc programs,
> so no use of LazUtf8. It pointed out that the Lazarus part of
> the wiki (Better Unicode support) could be interpreted wrong.

No. You interpreted it wrong for some reason. The page is only about
the new Unicode support which is very clearly mentioned there!
You don't have to use the UTF-8 mode which is explained in another page :

The main message however is that the new mode should be used unless
there is a very good reason not to. That's why it was made default
when LazUtils / LazUTF8 is used.
For console apps you must add the dependency / unit explicitly but it
does not change any facts about the mode.

Anyway, the original issue was about inserting {codepage UTF8}
automatically to every unit.
We can conclude it is not a good idea. It does not solve anything when
using plain constants with default String type but adds conversion
overhead. It breaks things when using constants with ShortString and

It only improves things with UnicodeString constants which is not
necessarily needed at all, but can be used with added {codepage UTF8}.
Simple, no hassle!

Besides I feel the problems are exaggerated again.
The problems discussed here are only about constants.
The automatic conversion between variables works always.


More information about the Lazarus mailing list