[fpc-pascal] SetString and result CodePage

LacaK lacak at zoznam.sk
Tue Oct 4 12:20:50 CEST 2016


Hi,

Am I right, when I say, that SetString(S, P, L) sets S code page do 
declared code page of S ?

(So that SetString does not expect, that buffer pointed by P contains 
string encoded in CP_ACP)?

So when S is UTF8String then after SetString S will have dynamic 
codepage = CP_UTF8 and

when S is AnsiString then after SetString S will have dynamic codepage = 
CP_ACP ?

(In both case S will contains same bytes)


Btw this documentation page 
http://www.freepascal.org/docs-html/rtl/system/setstring.html says about:

procedure SetString(out S: AnsiString; Buf: PAnsiChar; Len: SizeInt);

but when I type SetString( in code help hint says:

procedure SetString(out S: RawByteString; Buf: PAnsiChar; Len: SizeInt);

difference in S declaration (once AnsiString, second RawByteString) 
probably caused by lines in astrings.inc:

1411    {$ifdef FPC_HAS_CPSTRING}
1412    Procedure fpc_setstring_ansistr_pansichar(out S : RawByteString; 
Buf : PAnsiChar; Len : SizeInt; cp: TSystemCodePage); rtlproc; compilerproc;
1413    {$else}
1414    Procedure SetString(out S : AnsiString; Buf : PAnsiChar; Len : 
SizeInt);
1415    {$endif}

May be that line 1414 should be also RawByteString ?

Thanks

-Laco.




More information about the fpc-pascal mailing list