procedure TestString;
var
  Original:string;
  Converted:string;
begin
  original:='ESPA'#209'A'; //ESPAÑA WIN1252
  Converted:=ansiToUtf8(original);  // converts to 'ESPA'#239#191#189'A'
 // converted Should be 'ESPA'#195#145'A'
end;

I've tried playing with strings types, string, rawstring,ansistring, utf8string. No way. Any hint?


To explicityly convert between run-time code pages you can use procedure: SetCodePage(var s: RawByteString; CodePage: TSystemCodePage; Convert: Boolean = True)

SetCodePage(original, 1252, False);
SetCodePage(original, CP_UTF8, True);

-Laco.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to