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

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Mar 31 14:56:55 CEST 2016


On Thu, 31 Mar 2016 14:32:27 +0200
Bart <bartjunk64 at gmail.com> wrote:

> On 3/31/16, Mattias Gaertner <nc-gaertnma at netcologne.de> wrote:
>[...]
> So, when my usecase for string constants with diacritics in real life
> most of the time is just captions for buttons/menu's etc., the extra
> overhead will not really be something to worry about I guess,and in
> this scenario adding {$codepage utf8} may be the wise thing to do: it
> eliminates all confusion about the intended encoding of the string
> constant.

Well, I'm not so sure about the "eliminates all confusion" as Rick Cook
said:
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying
to build bigger and better idiots. So far, the universe is winning."

 
> So, my current intended approach for GUI applications will be:
> - declare all strings as just String
> - have stringconstants with unicode character all in one file and add
> {$codepage utf8) to that file, and then don't use -FcUTF8 anymore
> (which is what I'm doing ATM),
> 
> That should be rather safe then I guess.

Yes. 
If you avoid PChar(Literal), invalid UTF-8 and #0.

 
> Will all this mess go away if we would go the Delphi way (String=UnicodeString)?
> (I know *nix users are going to hate me now)

Which mess do you mean?
As long as you have to consider codepages, you can get a mess.

Mattias




More information about the Lazarus mailing list