[Expat-discuss] Re: ASCII "unknown encoding" [WAS: iso-8859-1
"unknown encoding" ?]
Karl Waclawek
karl at waclawek.net
Sun Feb 6 17:48:01 CET 2005
Alexander Indenbaum wrote:
> Hello,
>
> I re-checked and it looks I dis-informed you. The declared encoding
> was "ASCII" and not "iso-8859-1".
>
> <rant>
> According to IANA ( http://www.iana.org/assignments/character-sets )
> ASCII is a valid alias to ANSI_X3.4-1968, yet it still returns error
> 18 ( unknown encoding ).
> </rant>
According to the docs, Expat unserstands the name US-ASCII, which is
also the preferred name used by IANA. Expat does not try to understand
all IANA aliases for a specific encoding. Also, technically speaking,
US-ASCII is a subset of UTF-8 and therefore you don't even need
an encoding declaration.
In your case, if the document is declared as "ASCII" and you can't
change that, just force Expat to treat it as "US-ASCII".
This is done by passing an encoding name to XML_ParserCreate.
Karl
More information about the Expat-discuss
mailing list