On Sat, 23 Jul 2016 00:29:32 +0200 Bart <bartjun...@gmail.com> wrote:
> On 7/22/16, Jonas Maebe <jonas.ma...@elis.ugent.be> wrote: > > >> ResultA := AnsiToUTF8(AnsiStrA + AnsiStrA); // UTF-8 ResultB := > >> AnsiToUTF8(AnsiStrA) + AnsiToUTF8(AnsiStrA); // Win-1252 > >> > >> > >> And resultA is not equal to ResultB > >> > >> It doesn't look like too intuitive. > > > > It would be good if someone with access to Delphi 2009+ could test this. > > I asked on Dutch Delphi forum if someone could test with D2009 or up. Here is a result of Delphi 10.1: program DTestConcatenate; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; var s1,s2,s3: AnsiString; r1,r2,r3: RawByteString; begin s1:='A'; // 1252 s2:='AƤ'; // 1252 writeln('s1="',s1,'" cp=',StringCodePage(s1)); writeln('s2="',s1,'" cp=',StringCodePage(s2)); r1:=AnsiToUTF8(s1); // 65001 r2:=AnsiToUTF8(s2); // 65001 writeln('r1="',r1,'" cp=',StringCodePage(r1)); writeln('r2="',r2,'" cp=',StringCodePage(r2)); r3:=r1+r2; // 65001 writeln('r3="',r3,'" cp=',StringCodePage(r3)); s3:=r1+r2; // 65001 writeln('s3="',s3,'" cp=',StringCodePage(s3)); end. Mattias _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal