[jdom-interest] Todo list [eg]

Rosen, Alex arosen at silverstream.com
Mon Apr 30 16:05:24 PDT 2001


> Older JVMs don't accept UTF-8 as a name.  It's a case where
> Java doesn't recognize the XML-style name.

Doing some quick testing with JDK 1.1, it looks like it doesn't accept "UTF-8",
only "UTF8". It doesn't support UTF-16, no matter how it's written. (Neither
does JDK 1.2, but 1.3 does.) JDK 1.1 supports the standard names for the other
major encodings just fine.

In order to support UTF-8 on JDK 1.1, and to ensure that all XML documents are
output with valid encoding values, I propose that the special-casing logic be
moved from printDeclaration() to makeWriter(). I.E. remove the the code in
printDeclaration() to accept "UTF8", and instead change makeWriter() to
translate "UTF-8" to "UTF8". And initialize the "encoding" member variable to
"UTF-8". Then, we can state that the interface to XMLOutputter can use only
XML-standard encoding names. (With the existing logic, that wouldn't be true
for JDK 1.1.)

What do you think?

Alex



More information about the jdom-interest mailing list