isaacs/sax-js — Issue #56: handle encoding="..." of xml-processing instruction
Author: hgoebl
Created: 2011-12-20 22:03:05+00:00
State: open

Hi,

if I understand the code correctly, the encoding of the first line of an XML document is not respected.
In case of non-utf8 encoded XML files, it could be a problem.

I tried to patch a bit, but it is a very stupid solution and actually just doesn't work: https://gist.github.com/1503453

IMO the problem is, that the parser is eating chunks and at this moment the buffer is already converted to a String.
Changing the encoding would only take effect after new chunks arrive and only in the streaming parser.

I'm afraid I'm lacking deep knowledge of streaming, piping and the architecture of the parser.
But I could do some testing with strange German XML documents ;-)

--Heinrich