I have one field in Database ( Sql Server DB 2000) with varchar field in which i have stored Thai Sentence (in the form of Unicode ).I am using the Locale object to convert the unicode data into Thai sentence as follows
NumberFormat thai = NumberFormat.getNumberInstance(new Locale("th", "TH", "TH"));//Line1
String thaiText = ResultSet.getString(i);// Data Fetched From DB//Line2
double number = thai.parse(thaiText).doubleValue();//Line3
String outputString= nf.format(number);//Line4
I am getting the following exception on line no 3 :-
java.text.ParseException: Unparseable number: "ä¢è»ÅÒËÅèÍ"
The problem is not in line 3; i.e. it is not with the way you are parsing the string.
The contents of
thaiTexthas been corrupted due to an earlier problem with encodings. You need to track down where the text is going bad.Figure out which of the above is the case, and that will tell you where you need to fix the problem.