Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-10

SetString and result CodePage

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

LacaK

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.

Reply by email