AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi UTF8-kodierte Datei (OHNE BOM!) korrekt in Memo laden?

UTF8-kodierte Datei (OHNE BOM!) korrekt in Memo laden?

Ein Thema von freejay · begonnen am 16. Nov 2009 · letzter Beitrag vom 17. Nov 2009
 
mjustin

Registriert seit: 14. Apr 2008
3.010 Beiträge
 
Delphi 2009 Professional
 
#7

Re: UTF8-kodierte Datei (OHNE BOM!) korrekt in Memo laden?

  Alt 16. Nov 2009, 17:11
UTF-8 mit BOM hatte ich heute auch als Fehlerquelle in Delphi 2009 lokalisiert - ein XML SAX Parser beschwerte sich darüber ("Content not allowed in prolog"), dass er bei TStringlist.SaveToFile( ..., TEncoding.UTF8) immer erzeugt wird.

Ein BOM wird bei UTF-8 nicht empfohlen:

A UTF-8 BOM is explicitly allowed by the Unicode standard, but is not recommended
http://en.wikipedia.org/wiki/Byte-or...rk#cite_note-2

Zitat:
"The Unicode Standard 5.0, Chapter 2:General Structure" (PDF). pp. 36. http://www.unicode.org/versions/Unicode5.0.0/ch02.pdf. Retrieved 2008-11-30. "Use of a BOM is neither required nor recommended for UTF-8, but may be encountered in contexts where UTF-8 data is converted from other encoding forms that use a BOM or where the BOM is used as a UTF-8 signature"
The presence of the UTF-8 BOM may cause interoperability problems with existing software that could otherwise handle UTF-8
http://en.wikipedia.org/wiki/UTF-8#Byte-order_mark

Als Workaround habe ich im Internet (bei Expert Exchange) den Tipp entdeckt, die UTF8 Encoding Klasse abzuleiten.


Bei Verwendung von TXmlDocument.SaveToFile dagegen wird für UTF-8 kein BOM geschrieben - was (für XML Dateien) das Problem einfach löst.


Cheers,
Michael Justin
habarisoft.com
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:43 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz