Java Mailing List Archive

http://www.junlu.com/

Home » JDOM Projects »

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

Jacques wong

2008-04-01

Replies: Find Java Web Hosting

Author LoginPost Reply
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.




至醒搜尋和瀏覽網絡的免費工具列 — Windows Live 搜尋工具列
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.