[fpc-devel] Unicode support (again)

Vincent Snijders vsnijders at vodafonevast.nl
Tue Nov 11 15:43:35 CET 2008

Jonas Maebe schreef:
> On 11 Nov 2008, at 15:26, Vincent Snijders wrote:
>> Jonas Maebe schreef:
>>> It seems much more advisable to me to save the file with an UTF-8 
>>> BOM, or even better to add {$encoding utf-8} (and/or to pass -Fcutf-8 
>>> to the compiler) and then just use
>>> Edit1.Caption := UTF8Encode('hallo äöü');
>> As an extra bonus of not adding the UTF-8 BOM, you don't have to use 
>> conversions to assign the UTF8 string in the source, translated by the 
>> compiler to a UTF16 string, to an UTF8 encoded ansistring. It saves a 
>> conversion at compile time and a conversion at run time.
> And breaks all widestring usage.

Breaking *all* widestring usage is maybe a little exagerated, but it gets more 
complicated, certainly. All widestring usages have to use UTF8Decode. Fortunately, 
in Lazarus code widestrings are not used that often, I think. At least less often 
than UTF-8 encoded strings in ansistrings.


More information about the fpc-devel mailing list