[fpc-devel] FPC 2.3.1 seems a mixed mess with Unicode support

Florian Klaempfl florian at freepascal.org
Tue Sep 15 13:17:24 CEST 2009


Graeme Geldenhuys schrieb:
> Florian Klaempfl het geskryf:
>> You should have tested with the unicode string branch one year ago ;)
> 
> I gave up a long time ago testing "unstable" FPC branches with
> production code. Things change to often. I only test with the new FPC
> when it is announced that a new version ('fixes' branch is created) is
> on its way.

Then you shouldn't cry if a release candidate breaks your stuff :) We
can only fix stuff we know about.

> 
> 
>> Who says that? What is not supported?
> 
> This I found myself:
> * Unicode+Variants... varUString type.
> 
> By Google'ing for some D2009 unicode examples and searching the FPC
> source. Here I list a few that I found in under 5 minutes:

Fill bug reports if you need and use it.

> 
> http://www.bobswart.nl/Weblog/Blog.aspx?RootId=5:2894
> * No TCharacter Class
> 
> http://www.bobswart.nl/Weblog/Blog.aspx?RootId=5:2879
> * No CharInSet() function
> * No IsSurrogate() function
> * No IsSurrogatePair() function

Can be done within minutes if needed.

> 
> http://www.bobswart.nl/Weblog/Blog.aspx?RootId=5:2874
> * No ConvertFromUtf32() function
> 
> http://edn.embarcadero.com/article/38437
> * As per Embarcadero example. I substituted String for UnicodeString.
> Compile and run and I do not see the 世 character as mentioned in the
> article.

Indeed, FPC keeps a certain degree of backward compatibility.
sizeof(Char) will be always 1, at least in the language modes currently
implemented in FPC.

> -----------------------------
> program test2;
> 
> {$mode objfpc}{$H+}
> uses
>   Classes, SysUtils;
> 
> var
>   MyChar: Char;
>   MyString: UnicodeString;
> begin
>   MyString := '世界您好';
>   MyChar := MyString[1];
>   writeln(MyChar);
> end.
> -----------------------------

BTW: This is UCS coding style as well ;)

> 
> 
> So than was just in 5 minuets. I pretty confident, if I keep going I can
> list a lot more. Hence I can't believe you think FPC supports Unicode
> like Delphi 2009+ does.

I implemented what people needed so far.

> 
> 
>> claims to support the UnicodeString type fully and it can be that bad
>> because e.g. MSE is using it afaik.
> 
> MSE only uses the BMP, nothing above that. No support for surrogate
> pairs. So at best MSE is only UCS-2 compliant and NOT Unicode compliant.
> Don't confuse the two.

This is only a matter of the helper functions.



More information about the fpc-devel mailing list