Re: enabling utf8 encoding for sax parer XML::SAX::Expat
Robin Berjon <[email protected]>
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
On Apr 28, 2009, at 13:41 , eyal edri wrote:
> • how can i tell the parser to open the xml in a certain encoding
> (despite the sender fucked up and didn't add the magic numbers) ?
As Michael explained, it's not so much about magic numbers (unless
you're in UTF-16 and the encoding isn't declared, but that really is
orthogonal). If you want to parse a file, it really has to be in the
right encoding in its entirety.
If you're getting XML documents that are in encoding X and don't
declare so, then I'd recommend using the Encode module to convert them
from X to UTF-8, and then parse that without telling the parser
anything specific.
--
Robin Berjon - http://berjon.com/
Feel like hiring me? Go to http://robineko.com/
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs