List of utility methods to do UTF Convert
String | UTFToGB(String ostr) UTF To GB try { return ostr == null ? ostr : new String(ostr.getBytes("UTF-8"), "GB2312"); } catch (Exception e) { return ostr; |
String | utfToGBK(byte[] srcByte) utf To GBK StringBuffer str = new StringBuffer(); int len = srcByte.length; int char1, char2, char3; int count = 0; while (count < len) { char1 = srcByte[count] & 0xff; switch (char1 >> 4) { case 0: ... |
String | utfToString(byte[] src, int srcIndex, int len) Return bytes in Utf8 representation as a string. char dst[] = new char[len]; int len1 = utfToChars(src, srcIndex, dst, 0, len); return new String(dst, 0, len1); |