[jdom-interest] SaxBuilder.build(url) and encoding

Rodrigo Alvarez ralvarez at dybox.cl
Wed Dec 11 13:00:03 PST 2002


Hi,

I´ve a problem with encoding and using SaxBuilder.build(url) method.
It seems that the SaxBuilder.build(url) method does not check for the 
encoding attribute in the xml head tag
Is this correct, or is it just me?
The following xml does give a JDOMException[Malformed UTF-8 char] when read 
by SaxBuilder.build(url) but works
fine when read by SaxBuilder.build(File) or SaxBuilder.build(String)

<?xml version="1.0" encoding="ISO-8859-1"?>
<dybox>
   <current_date week_day="mié">
     <day>11</day>
     <month>12</month>
     <year>2002</year>
     <hour>15</hour>
     <minute>32</minute>
     <second>33</second>
     <formated_date>20021211</formated_date>
   </current_date>
</dybox>

My solution to the problem was read URL stream into a StringBuffer and then 
build Document object.
I´m not satisfied with this solution so I wonder if someone else have had a 
similar problem or can confim that
there really is a problem with JDOM.

/Rodrigo


Rodrigo Alvarez
DyBOX Consulting and Development

Hernando de Aguirre 906 Providencia.
Santiago, Chile.
(562) 231 7840





More information about the jdom-interest mailing list