For generating error messages, how many lines of context
ProtocolEncoding
If you know (e.g. from an HTTP header) what the character encoding is,
use this to tell expat. The values must be one of {UTF-8,
ISO-8859-1, UTF-16, and US-ASCII}.
If you don't provide this, expat will try to guess the encoding itself
(and usually succeed).
new XML::Parser(ErrorContext => 2, ProtocolEncoding => $EncFromHeader);