View Single Post
  #2 (permalink)  
Old 08-07-2007, 07:32 AM
trill trill is offline
Member
 
Join Date: Jul 2007
Posts: 40
trill is on a distinguished road
According to this website, latin1 is this charset: ISO-8859-1
Supported Encodings

And my charset for my MySql DB is character_set_database latin1.

So. Whatever I did to make it UTF-8 didn't work. It was still latin1 coming out. Basically, characterEncoding=UTF-8 and String str = new String(stringBytes , "UTF-8"); didn't work.

So, I finally assumed that it was latin1 coming back all the time. Here's the code that converts it to UTF-8:
Code:
private String convertStringFromLatin1ToUTF8(String stringForconversion) { try { String stringToConvert = stringForconversion; byte[] convertStringToByte = stringToConvert.getBytes("ISO-8859-1"); return new String(convertStringToByte, "UTF-8"); } catch (UnsupportedEncodingException e) { System.out.println"convert String FAILED: " + stringForconversion + "<br/>"); return stringForconversion; } }
Greetings.
Reply With Quote