[jdom-interest] Special characters at the beginning of XML file.

Jason Hunter jhunter at acm.org
Wed Apr 16 19:37:45 PDT 2003


Those two bytes are the byte-order mark, used by UTF-8.  An XML parser
should be able to handle it fine (it's not done by JDOM itself), but if
you're using a Reader you'll have to make sure it has the right encoding
on your own.  See the Javadocs for details.

-jh-

John wrote:
> 
> I would bet that is the unicode prefix Windows uses, either FF FE or FE FF.
> You sould be able to save the file with notepad and tell it not to save as
> UNICODE.
> 
> JDOM should handle this, its fairly common.
> 
> John Kienitz
> 
> On Wednesday 16 April 2003 04:38 pm, David Parker wrote:
> > I have seen this error twice now.
> > I think that they are introduced by MS Notepad.
> > I had an xml editor plug-in for Eclipse that allowed me to see them and
> > delete them.
> > I have re-installed Eclipse, lost the plug-in and can not clean the file.
> >
> > I am able to see ??<?xml version="1.0" encoding="UTF-8" standalone="no"?>
> > in the console window with the echoUtf8Input() method.
> > See attached MC.xml and method below.
> >
> > I have looked at the file with XMLSPY version 5 release 3
> > and it thinks that it is well-formed and valid.
> >
> > Clearly it ignores the leading characters.
> > But I get an org.jdom.JDOMException if I attempt to create a jdom document:
> >
> > this.doc = builder.build(this.input);
> >
> > There is something strange about these chars in the Windows environment.
> > If I attempt to copy the text ( System.out.println(buffer.toString()); )
> > from the console window, the only thing I am able to paste is:
> > ??<
> >
> > This is a bug in jdom and needs to caught and handled "better".
> >
> > If you are able to see the garbage leading chars please let me know how and
> > which viewer or editor you are using.
> >
> > Thank you.
> >
> > David Parker <dlparker at facstaff.wisc.edu>
> >
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list