<div dir="ltr">Hello,<div><br></div><div>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.</div><div><br></div><div>Consider the following code:</div><div><br></div><div>{$IFDEF FPC}</div><div>{$codepage utf8} // I need to keep my unit in UTF-8<br></div><div>{$ENDIF}</div><div><br></div><div><div>var</div><div> a: AnsiString;</div><div> la: Integer;</div><div> pa: PAnsiChar;</div><div> b: Byte;</div><div> bs: TBytes;</div><div>begin</div><div> a := 'aã';</div><div> pa := @a[1];</div><div> la := strlen(pa);</div><div> WriteLn('L: ', la);</div><div> SetLength(bs, la);</div><div> StrMove(@bs[0], pa, la);</div><div> for b in bs do</div><div> WriteLn(b);</div><div>end;</div></div><div><br></div><div>On Delphi, I get:</div><div><br></div><div><div><b>L: 2</b></div><div>97</div><div>227</div><div><br></div><div>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:</div><div><br></div><div><div><b>L: 3</b></div><div>97</div><div>195</div><div>163</div></div><div><br></div><div>And finally a get a wrong content in my final buffer.</div><div><br></div><div>So, is the FPC StrMove() function compatible with the Delphi one?</div><div><br></div><div>Thank you!</div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Silvio Clécio</div></div></div>
</div></div>