[fpc-devel] Unicode support (yet again)
Luiz Americo Pereira Camara
luizmed at oi.com.br
Wed Sep 14 11:19:33 CEST 2011
On 14/9/2011 03:40, Graeme Geldenhuys wrote:
> On 14/09/2011 03:56, Luiz Americo Pereira Camara wrote:
>> I propose that the above behavior be implemented as a type named RTLString
> The Object Pascal language already has enough damn string types. I
> really don't think we should be adding fuel to the fire, by adding yet
> more string types!
>
AFAIK RTLString already exist in the cpstr branch. Anyway is just a
alias to a real type.
[]
> String could be define as follows... [ignore the syntax]
>
> IFDEF unix
> String = String(utf8);
> ENDIF
> IFDEF windows
> String = String(utf16)
> ENDIF
> IFDEF OldDelphi
> String = AnsiString // of if some String(xxx) could be used
> ENDIF
>
This is not desirable simply because at each platform (windows / unix)
the user code of the same program will have a different encoding
increasing the possibility of subtle errors. Some functions like string
streaming requires the same encoding between platforms otherwise it will
require code change to work properly.
Another advantage of using RTLString as i proposed is that Lazarus will
require almost no code change since the encoding of string in LCL will
be the same (UTF8) across platforms. The conversion will take place only
when interacting with the RTL
Luiz
More information about the fpc-devel
mailing list