Search This Blog

Java

Brush-Up your Java Knowledge
http://www.allapplabs.com/interview_questions/java_interview_questions.htm#q15

 ====================================================================
Convert ISO to UTF-8:
Break string to Bytes using current string encoding format and then arrange those bytes in required encoding format.
 e..g. Here, statusLine, errorCode and errorMsg are the string in ISO format & o/p will be in UTF-8 format.
String encodedStatusLine =
new String(statusLine.getBytes( iso-8859-1 ), utf-8);
 String encodedErrorCode =
new String(errorCode.getBytes( iso-8859-1 ), utf-8);
String encodedErrorMsg =
new String(errorMsg.getBytes( iso-8859-1 ), utf-8);
 ====================================================================