[jdom-interest] document encoding
Elliotte Rusty Harold
elharo at metalab.unc.edu
Thu Jun 28 07:14:15 PDT 2001
At 10:59 AM +0200 6/28/01, Ken Rune Helland wrote:
>Maybe a FilterStream/FilterReader subclass that locks for
>the <?xml ... ?> line and remebers the encoding declared.
>
It's doable, but not as easy as you think. Make sure you pay
attention to the byte order mark, and use the heuristics listed in
the XML spec. Be careful to handle the case where there is not XML
declaration. You cannot just assume that the beginning of the file
can be read as ASCII. In many cases, it can't be.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| The XML Bible, 2nd Edition (Hungry Minds, 2001) |
| http://www.ibiblio.org/xml/books/bible2/ |
| http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/ |
+----------------------------------+---------------------------------+
More information about the jdom-interest
mailing list