[fpc-devel] Trying to understand the wiki-Page "FPC Unicode support"

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Nov 26 12:10:00 CET 2014

On Wed, 26 Nov 2014 11:23:17 +0100
Michael Schnell <mschnell at lumino.de> wrote:

> 2) I fail to understand how with this explanation that seems to force 
> auto conversion for assignments between types with different "code page" 
> settings (also for CP_ACP) the "static code page can differ from the 
> dynamic code page" can happen.

For example:
CP_ACP=0, DefaultSystemCodePage=1252
That means static code page is always 0, while dynamic code page can be
0 or 1252. Both describe the same encoding.

RawByteString has static cp CP_NONE=$FFFF, but its dynamic cp is always
different, for example CP_ACP=0, 1252 or CP_UTF8.

> In fact this disaster seems to be able to happen (see section 
> "RawByteString") if assigning a string with a static code page X1 to a 
> RawByteString (hence no conversion) and then assigning that 
> RawByteString to a string with a static code page X2 (no conversion 
> again). In fact I assume that without abusing RawByteString such 
> "intersexual" strings can't be produced, otherwise this would be rather 
> disastrous for normal users.

You can use SetCodePage as well. ;)

> In section "RawByteString":
> "the results of conversions from/to the CP_NONE code page are undefined."

... because CP_NONE is not a real code page.


More information about the fpc-devel mailing list