[fpc-devel] utf8 in 2.6.0

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Jan 1 17:25:53 CET 2013


On 01 Jan 2013, at 16:54, Martin Schreiber wrote:

> On Tuesday 01 January 2013 16:44:28 Jonas Maebe wrote:
>> The strings are stored as ansistrings with the appropriate code page.
>> 
> So 
> "
> UnicodeStringVariable:= 'abcdäüö';
> "
> always will call a conversion function?

The assignment node will insert a type conversion of the right hand side to unicodestring.

In 2.6.x, the right hand side will already be a unicodestring and nothing will happen.

In 2.7.x, the type conversion node will be simplified into a unicodestring constant because it is a typeconversion of a constant (just like int64(1) is also handled at compile time).

> And how works
> "
> {$codepage 8859-1}
> ...
> UnicodeStringVar:= 'abcd'#228#246#252#1092#1080#1089#1074;
> 
> "
> ?

That string contains codepoints > #255 and hence is a unicodestring rather than a single byte string. No conversion at either compile or run time happens, and the codepage directive has no influence.


Jonas


More information about the fpc-devel mailing list