[fpc-devel] String handling in trunk (was utf8 in 2.6.0)

Martin Schreiber mse00000 at gmail.com
Sat Jan 5 13:33:42 CET 2013


On Saturday 05 January 2013 12:57:44 Jonas Maebe wrote:
> On 05 Jan 2013, at 12:53, Martin Schreiber wrote:
> > So compiled with -Fcutf8
> > "
> > unicodestringvar:= 'Best'#228'tigung';
> > "
> > produces a different result on fixes_2_6 and trunk? I assume in trunk
> > there will be a compile error?
>
> No. In both cases it results in a widestring with this content:
>
> .short	66,101,115,116,228,116,105,103,117,110,103,0
>
> I guess invalid utf-8 values are just copied through by the compiler. As
> mentioned: absolutely nothing whatsoever changed in how character sequences
> are interpreted by the compiler in 2.7.x. The explanation you quoted above
> (and which I deleted) applies to both 2.6.x and 2.7.x. I really don't know
> how I can say this in another way, and repeating it clearly doesn't help.
>
> I think it's best if you compile trunk for yourself and test as many
> scenarios as you can, because I feel I cannot add anything further to the
> discussion, and I'm not interested in playing compile bot.
>
Then it was a misunderstanding again because I read
"
Alternatively, in both cases you can instead define a unicodestring/widestring 
constant instead of an ansistring/shortstring constant by embedding widechar 
constants in the character sequence. Such widechar constants are of the form 
#<number> with <number> a valid Pascal representation of an integer constant 
between 255 and 65535.
"
and
"
Whether or not they contain character literals whose value is >#127 in the 
source code's code page, or explicit "#xx", "#xxx" etc expressions has no 
influence, nothing changed in the compiler in that account.
"
and
"
I have no idea how anything I wrote suggests that it wouldn't. As mentioned, 
the only difference is that string constants containing characters >#127 are 
no longer always converted to unicodestring constants at compile time.
"
--> >#255 <> >#127 and the question arose how can one define "widechar 
constants" for strings without a character value >255.

Martin

Martin



More information about the fpc-devel mailing list