ReaderInputStream vs XmlParser declared and detected encodings

Mark Wielaard <[email protected]>
Newsgroups gmane.comp.java.classpath.extensions.xml
Message-ID <[email protected]>
Hi,

When a DomLSInput gets a Reader to read the xml stream from it will
convert this to a gnu.xml.dom.ls.ReaderInputStream with a default
encoding of "UTF-16". This gives a bit of trouble when te aelfred2
XmlParser tries to guess the encoding (it "correctly" guesses UTF-16LE)
and detects that the XML document itself declares the document to have
another encoding.

When changing the default encoding of a ReaderInputStream to "UTF-8" I
can get much further with applications (like eclipse 2 and 3) that seem
to wrap all XML data into readers (since the documents that are read all
declare their encoding to be UTF-8). So I would propose to at least
change the default to "UTF-8" since I guess that is what most xml
documents will declare anyway.

   ReaderInputStream(Reader reader)
   {
     this.reader = reader;
-    encoding = "UTF16";
+    this.encoding = "UTF-8";
   }

But this seems a deeper problem with handling InputStream <-> Reader
interaction combined with XML documents that declare their own encoding.
I don't have a clue how to handle it properly though since when you use
a Reader you do that to hide the underlying encoding in the first place,
so it doesn't mix well with documents declaring their own encoding
format...

Cheers,

Mark

_______________________________________________
Classpathx-xml mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpathx-xml
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBBsy1pxVhZCJWr9QwRAjlWAJ9s1BfDLhjusKdvEuRm3G+EPLm7yACgl8gZ
5hpd/1t+mnB0FSSA9FWQFNA=
=dG+V
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.