Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

Re: [jdom-interest] jdom

Phill Perryman

2004-04-01



If you use wordpad and save as a text document (not unicode text) then you don't get the 3 bytes added. A quick look with HexEdit shows what is actually in the file.

/Phill
IS Dept, Software Engineer.
phill_perryman@mitel.com
http://www.mitel.com
Tel: +44 1291 436023



Laurent Bihanic <laurent.bihanic@atosorigin.com>
Sent by: jdom-interest-admin@jdom.org

01/04/2004 08:45

       
        To:        "M.Novosselov" <novosselovm@3web.net>
        cc:        jdom-interest@jdom.org
        Subject:        Re: [jdom-interest] jdom



Hi,

M.Novosselov wrote:
> I got a few surprises while testing my program. I wrote test XML file in
> notepad and saved it using UTF-8 encoding. To my surprise I got a
> parsing exception thrown by SAXBuilder:
> root-element is missing. When I saved same file using other encodings -
> everything worked fine (btw file with UTF-8 encoding had size 3 bytes
> bigger than others).

When requested to saved in Unicode format (UTF-8 or 16), Notepad adds a 2, 3
or 4-byte long "Byte Order Mark" (BOM) header to the file data (for more
information: http://www.unicode.org/faq/utf_bom.html)
Some parsers handle this header correctly (Xerces) some don't (Crimson).

Laurent
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com


©2008 junlu.com - Jax Systems, LLC, U.S.A.