使用delphi xe将iso_8859_1字符串转换为win1253

GBA*_*KAS 0 delphi encoding delphi-xe

我怎么能用delphi xe做这个转换?我尝试过使用libiconv2但没有用.

Rem*_*eau 5

使用Dephi内置的AnsiString charset支持是最好的:

type
  // ISO-8859-1 and Windows-1252 are NOT the same, but
  // are commonly interchanged when they should not be!
  Latin1String = type AnsiString(28591);
  Windows1252String = type AnsiString(1252);
  GreekString = type AnsiString(1253);

procedure DoIt;
var
  S1: Latin1String;
  S2: Windows1252String;
  S3: GreekString;
begin
  S1 := '...'; // auto-converts to ISO-8859-1
  S2 := S1; // auto-converts from ISO-8859-1 to Unicode to Windows-1252
  S3 := S1; // auto-converts from ISO-8859-1 to Unicode to Greek
end; 
Run Code Online (Sandbox Code Playgroud)