[fpc-devel] new string - question on usage

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Oct 10 23:36:16 CEST 2011


On 10 Oct 2011, at 23:11, Martin wrote:

> On 10/10/2011 21:56, Jonas Maebe wrote:
>>> 2- It should have (dont know if currently has) a compiler switch to change the default code page to UTF8 or whatever, so all variables with type String will map to UTF8String.
>> I doubt that such a feature will be added. If you want that, declare your own string type with whatever default code page you want to use and use that type everywhere.
>> 
> But that will always just push the issue to another location.

Changing the default code page of the "string" type in a particular unit via a compiler switch would not change that (a program usually also uses units that have been compiled earlier on, and those may then have used a different default code page).

> Somewhere the change from string to utf8string must be made.

As long as that string contains correct code page information, that is no problem. But as mentioned in the message by Luiz: "AFAIK the fpc feature is incomplete and buggy so it will not work anyway and making workarounds to it now is a bad decision." He is correct. Especially regarding constant strings there are still several bugs. Some of them may or may not be fixed by the patches from http://bugs.freepascal.org/view.php?id=20449

> And what happens if an app did read data from some external source (serial port) and then wants to declare what encoding it is?

http://docwiki.embarcadero.com/VCL/en/System.SetCodePage


Jonas


More information about the fpc-devel mailing list