[jdom-interest] SaxBuilder.build(url) and encoding
jhunter at servlets.com
Wed Dec 11 21:34:25 PST 2002
When you use a URL the underlying parser determines the encoding,
typically by looking at the declaration. If there isn't one, it assumes
UTF-8. You can even look at the JDOM code to determine exactly what
goes on. But this issue's with your parser or your file contents. Most
likely you have a wrongly encoded file, since parsers tend to be pretty
good about this.
Rodrigo Alvarez wrote:
> 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"?>
> <current_date week_day="mié">
> 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 Alvarez
> DyBOX Consulting and Development
> Hernando de Aguirre 906 Providencia.
> Santiago, Chile.
> (562) 231 7840
> To control your jdom-interest membership:
More information about the jdom-interest