[Lazarus] Lazarus (UTF8) and Windows: SysToUTF8, UTF8ToSys... Is there a better solution?

Graeme Geldenhuys graeme at geldenhuys.co.uk
Fri Dec 27 13:15:00 CET 2013


On 2013-12-27 09:16, Hans-Peter Diettrich wrote:
> But 
> when "string" becomes UTF-16, as in recent Delphi versions, Lazarus and 
> the LCL deserves heavy refactoring. That's the top discussion topic 
> right now.

Personally I think FPC and Lazarus should get rid of "string"
altogether! It should be a user definable type that can be defined per
project.

eg:
Projects could do the following

  type
    {$IFDEF WINDOWS}
    UnicodeString = UTF16String
    {$ENDIF}
    {$IFDEF UNIX}
    UnicodeString = UTF8String
    {$ENDIF}

   String = UnicodeString
   // or for backwards compatibility with old projects:
   //   String = AnsiString

or they could simply say they prefer to work with a specific encoding,
so use UTF16String or UTF8String directly. Thus no alias type needed.

Also the very broken logic of UnicodeString = UTF16String should
disappear. Unicode Standard <> UTF-16!!!  That is just some sh*t
Microsoft came up with and Delphi followed suite!  It's just WRONG. The
Unicode Standard exists of multiple encodings, not just one.

But that's just my 2c worth - and arguments like these have been raised
before.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/




More information about the Lazarus mailing list