[fpc-devel] Unicode support (yet again)

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Wed Sep 14 10:18:10 CEST 2011



On Wed, 14 Sep 2011, Felipe Monteiro de Carvalho wrote:

> On Wed, Sep 14, 2011 at 8:59 AM,  <michael.vancanneyt at wisa.be> wrote:
>> No, why do you think so ?
>
> Well, at the very least:
>
> 1> All var parameters from the RTL will no longer be directly usable
> with UTF-8 strings
>
> http://www.freepascal.org/docs-html/rtl/sysutils/appendstr.html
>
> How can I pass a UTF-8 string to AppendStr in the Unicode RTL?
>
> The Example62 from the docs will no longer compile =D

That depends on what the compiler will do for you :-)

>
> 2> TStrings will be in a different encoding from the rest of the LCL,
> this will surely be very nasty.
> MyForm.Caption := MyStrings.Strings[9]; and you get an encoding conversion...

That will always be the case, even if we decided for UTF-16.

>
> Basically it will be a salad of automatic conversions done by the compiler...

This will be so in each case where different codepages or encodings are used.

> 3> FileOpen(MyForm.Caption, whatever_mode);
> You get first utf-8 -> utf-16 to call FileOpen and then FileOpen does
> utf-16->utf-8 on UNIXes

Once more, why do you think so ?

In each case:

1. It will be messy whatever we do.
    Thinking there is an easy migration path is wishful thinking.

2. Backwards compatibility is a big concern.
    Code that compiled and worked should compile and work.

Michael.



More information about the fpc-devel mailing list