this slowpoke moves

Convert ANSI File to UTF-8

procedure ConvertANSIFileToUTF8File(AInputFileName, AOutputFileName: TFileName);
var
  Strings: TStrings;
begin
  Strings := TStringList.Create;
  try
    Strings.LoadFromFile(AInputFileName);
    Strings.Text := UTF8Encode(Strings.Text);
    Strings.SaveToFile(AOutputFileName);
  finally
    Strings.Free;
  end;
end;
Beispiel :
procedure TForm1.Button1Click(Sender: TObject);
begin
  if OpenDialog1.Execute then begin
  try
  ConvertANSIFileToUTF8File(OpenDialog1.FileName,
                OpenDialog1.FileName + '.txt');
  except
  ShowMessage('Sorry, but this is not a ANSi Format!');
  end;
 end;
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate