Re: [xml] Newbie encoding question



  Clean up your emails ! HTML mails and attachments not related to 
the topic are not welcome :-(

On Wed, Jan 22, 2003 at 05:50:18PM -0600, Berg, Erik wrote:
I have an xml file that does not have its encoding set.  This file

  It's an error !

contains the (c) character which cause xmlParseFile API not to run.

I would like to change the the default "UTF-8" encoding to "ISO-8859-1"
in code.  I tried playing with the xmlAddEncodingAlias() API but that
did seem to do what I what I though it was going to do.

  You cannot "change" it, you can tell the parser to use a specific
encoding there is a number of API in xmlIO.h which allow to create
I/O streams where the encoding is passed like
   xmlParserInputBufferPtr
   xmlParserInputBufferCreateFilename (const char *URI, xmlCharEncoding enc)
and it's from there possible to create a context and feed it with 
the given stream. It takes a bit of code, it's not a simple call,
it's feasible, but left as an exercise because the Right Thing to do
is to fix your data.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
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]