[jdom-interest] CDATA data (followup with more info)
laurent.bihanic at atosorigin.com
Wed Nov 6 05:04:22 PST 2002
I think your problem comes from the use of Java I/O Readers and Writers
instead of InputStreams and OutputStreams as recommended when dealing with XML
Typically, in your save() method, you do not set the XML encoding to be used
by XMLOutputter. Thus this latter assumes UTF-8 is being used while your
FileWriter actually outputs in ISO-8859-1.
You should try adding a call to XMLOutputter.setEncoding() in save() before
This would guarantee that the XML encoding in the XML header is consistent
with the file actual encoding.
As a more global recommendation, you should always use InputStreams and
OutputStreams when reading/outputting XML.
Duane Morin wrote:
> I've also included my save() and load() routines. I've done nothing to
> muck with the encoding, and calls to getEncoding() during both load and
> save tell me ISO8859_1.
> The scope for this personal project is NOT to write something that is
> internationalized (just doing a part time thing for fun on the train, and
> no it's not homework :)). I just want to identify the fact that I'm
> creating an illegal Element, and bail out. The line in question is
> actually the only one in a 1000 line test file that fails in this way, so
> I can't see going out of my way to test every line if I can help it.
> Any help greatly appreciated!
More information about the jdom-interest