Einzelnen Beitrag anzeigen

peterbelow

Registriert seit: 12. Jan 2019
Ort: Hessen
672 Beiträge
 
Delphi 11 Alexandria
 
#2

AW: Kaputte Datei ohne Encoding mit Umlauten in StringList laden+Zeichen erhalten

  Alt 15. Apr 2019, 10:53
Wenn die Datei Utf-8 ist, aber halt keine BOM hat, versuch mal eine Instanz dieses encodings:

Delphi-Quellcode:
type
  {!
  <summary>
  UTF8 encoding class without BOM, can be used to write files in
  UTF8 encoding without a BOM, e.g. XML or XHTML files.
  </summary>}

  TNoBomUTF8Encoding = class(TUTF8Encoding)
  public
    {!
    <summary>
    Return a zero-elements array to use as a BOM.
    </summary>}

    function GetPreamble: System.TArray<System.Byte>; override;
  end;

function TNoBomUTF8Encoding.GetPreamble: System.TArray<System.Byte>;
begin
  SetLength(Result,0);
end;
Peter Below
  Mit Zitat antworten Zitat