[Expat-discuss] iso-8859-1 "unknown encoding" ?

Karl Waclawek karl at waclawek.net
Thu Feb 3 19:24:41 CET 2005


Alexander Indenbaum wrote:
> Hello,
> 
> I'm new to expat and doing something basically wrong :{)
> 
> I'm using expat-2005-01-28. I've created parser with 
> XML_ParserCreate(NULL) and simple element start and end handlers.
> When I'm passing "iso-8859-1" xml buffer to XML_Parse() I'm getting 
> error 18 ( unknown encoding ). BTW xml without encoding specification
> parsed just fine.
> 
> What am I doing wrong?
> How should I handle the xml if I do not know from the beginning what
> kind on encoding it will use?

You only need to specify an encoding if the document does not have
an XML declaration (with a specified encoding) and the actual
encoding is not UTF-8, so that you have to force the parser to treat
it a specific way. For real unusual encodings you may have to do
that as well, since the parser may not be able to read the XML declaration.

Karl


More information about the Expat-discuss mailing list