[jdom-interest] String length shorten after .getChild().getText() is being used.

Jacques wong jacques_wong at hotmail.com
Tue Apr 1 05:09:02 PDT 2008


Hi,
 I'm using JDOM v1.1. Basically, I can use most of the function of the JDOM, but I found some stranges when I use Element.getChild().getText(); I've an XML that contain some big5 characters (externally created XML file), both using XMLOutputter for outputting screen and XML file have no affection on the big5 codeset displays. However, when I tried to query each text one by one by using Element.getChild().getText(), the String returned always is shorter than the original in XMLfile, and the Big5 characters are displayed incorrectly. I tried to use the conversion. String s = new String(recElement.getChild("ThxRegTxt").getText().getBytes("UTF-8"),"big5"); but seems it's not displaying correctly also. My default JVM charset is CP1252, but I don't think it's the reason for affecting this. What do you think the issue, can you offer some help? As if you can set charset for XMLOutputter, there should be something that can control the .getText() charset. Thanks. Regards,Jacques.
_________________________________________________________________
¦Ü¿ô·j´M©MÂsÄýºôµ¸ªº§K¶O¤u¨ã¦C ¡X MSN ·j´M¤u¨ã¦C 
http://toolbar.live.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20080401/f87d8881/attachment.htm


More information about the jdom-interest mailing list