Hello,

I want to use the StrMove() function in a unit compilable in Delphi (XE)
and FPC, but I don't know why it doesn't work on FPC.

Consider the following code:

{$IFDEF FPC}
{$codepage utf8} // I need to keep my unit in UTF-8
{$ENDIF}

var
  a: AnsiString;
  la: Integer;
  pa: PAnsiChar;
  b: Byte;
  bs: TBytes;
begin
  a := 'aã';
  pa := @a[1];
  la := strlen(pa);
  WriteLn('L: ', la);
  SetLength(bs, la);
  StrMove(@bs[0], pa, la);
  for b in bs do
    WriteLn(b);
end;

On Delphi, I get:

*L: 2*
97
227

Perfect, checking it via a character map, the 227 is the keystroke Alt+0227
that is the "ã" character, however, when I try this code in FPC (from
trunk), I get:

*L: 3*
97
195
163

And finally a get a wrong content in my final buffer.

So, is the FPC StrMove() function compatible with the Delphi one?

Thank you!

-- 
Silvio Clécio
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to