[fpc-devel] Unicode support - for the 20th time... ;-)

Daniël Mantione daniel.mantione at freepascal.org
Thu Nov 20 10:39:00 CET 2008

Op Thu, 20 Nov 2008, schreef Graeme Geldenhuys:

> On Thu, Nov 20, 2008 at 11:12 AM, Florian Klaempfl
> <florian at freepascal.org> wrote:
>> Ok, two questions for the example above:
>> - how do you maintain backward compatibility?
>> - how do you load a plain old ansi file?
> If the file is UTF-8 or ANSI, the above  should work. UTF-8 was
> designed to be backward compatible with ANSI. One of the beauties of
> UTF-8.

Wrong. It was designed to be compatible with ASCII, but incompatible with 
ANSI. A CP1250 encoded file won't show correctly in an UTF-8 encoded 

That's why you have to convert. In the current FPC, the compiler can infer 
the right conversion from type information only if the string is ansi 
encoded or UCS2/UTF16 encoded. It simply hasn't type information to do the 
other transformations correct. Therefore you have to call a function, 
there is nothing we can change about that.

> But yes, with other encodings it's a problem. And exactly the reason I
> think TStrings and the whole FPC for that matter should start
> supporting Unicode somehow.  And that's why I urge all core FPC
> developers to try and finalize a Unicode design.  Otherwise you leave
> it up to developers to keep adding such shitty hacks which could cause
> more issues in the long term - instead of solving issues.

Design is almost final. Just give us time to implement.


More information about the fpc-devel mailing list