On 2016-07-22 11:55, Bart wrote: > Gives: > StringCodePage(AnsiStrA) now is: 65001 > AnsiStrA: 195 179
I don't understand, why did AnsiStrA change its codepage type after the 3rd assignment to it? Here is the results on my Windows 7 system. ========================================== $ codepagestring.exe StringCodePage(AnsiStrA) now is: 1252 StringCodePage(AnsiStrA) now is: 65001 AnsiStrA: 195 179 ========================================== All I did to the last code example was duplicate the line of code that calls stringcodepage() as shown here... So I get a before and after result. ========================================== program codepagestring; {$mode objfpc}{$H+} procedure DisplayBytes(S:RawByteString); var i:Integer; begin Write(' '); for i:=1 to length(s) do write(ord(s[i]),' '); writeln; end; var AnsiStrA: String; begin writeln('StringCodePage(AnsiStrA) now is: ',stringcodepage(ansistra)); AnsiStrA:=' '; AnsiStrA[1]:=#243; // o acute win-1252 AnsiStrA := AnsiToUtf8(AnsiStrA); writeln('StringCodePage(AnsiStrA) now is: ',stringcodepage(ansistra)); Write('AnsiStrA: '); DisplayBytes(AnsiStrA); end. ========================================== Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal