• Jon © (05.11.08 01:52) [0]
    What is the best way to convert a Unicode file to an ANSI file?
    The function Koi8ToAnsi works well for the Cyrillic alphabet, is there a general UTF method?
    I understand that D2009 can do it with the TEncoding class but looking for a KOL and Delphi 7 equivalent.
  • L`Autour © (05.11.08 06:15) [1]
    WinApi: WideCharToMultiByte
  • samir105 © (05.11.08 16:11) [2]
    You can use Utf8Encode to convert unicode to utf8 and Utf8Decode to convert unicode to utf8.


    var
     ws: widestring;
     s: string;
    begin
     ws:='some unicode text';
     s:=Utf8Encode(ws); // Utf8 string
    end;

  • Jon © (05.11.08 18:05) [3]
    Thanks guys. I found that reading with a stream then writing to a text file worked.
Есть новые Нет новых   [134431   +15][b:0][p:0.001]