Re: [xml] setting the default charset ?



On Fri, Jul 27, 2001 at 08:20:21AM +0200, Cyrille Chepelov wrote:
      When libxml2 doesn't see the encoding="..." attribute, it defaults
to either UTF-8 or ASCII-7 (I don't remember which one), which in either

  UTF8 or UTF-16, or complains and use ISO-Latin-1. The latter is actually
a violation of the spec it should abort at that point.

case means trouble reading back the previously saved files. Problem: I'd
like to alter libxml2's behaviour (in a non-forking way, of course), to tell
it which charset to use in case none is specified in the XML header. I
haven't found how to do this cleanly and properly.

  If you know the encoding, it's still okay per the XML spec to start the
parser telling to use that encoding.
  Libxml2 suppports this kind of operations but it seems I don't export 
a clear API for it there is for example an entry point to create an HTML
parser context in those condition but not one for XML
  http://xmlsoft.org/html/libxml-parserinternals.html#HTMLCREATEFILEPARSERCTXT

  this could be easilly added.

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]