[fpc-pascal] Problem with StrMove() in a unit compilable in FPC and Delphi

silvioprog silvioprog at gmail.com
Thu Feb 25 20:28:48 CET 2016


On Thu, Feb 25, 2016 at 3:47 PM, Jonas Maebe <jonas.maebe at elis.ugent.be>
wrote:

> On 25/02/16 19:31, silvioprog wrote:
>
>  So, is the FPC StrMove() function compatible with the Delphi one?
>
> This has nothing to do with StrMove, since clearly the original string is
> already different. If you compile your source code in Delphi with
> --codepage=65001, it should give the same result as with FPC and {$codepage
> utf8}.


Indeed. But, what I need to do? Because this code below still returning "L:
3 - 97 195 163":

program Project1;

{$mode objfpc}{$H+}
{$codepage cp1252} // I don't know where I found all list of supported
codepages here ...

uses
  sysutils;

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

-- 
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160225/5836c1e0/attachment.html>


More information about the fpc-pascal mailing list