Java Utililty Methods Unicode to Chinese

List of utility methods to do Unicode to Chinese

Description

The list of methods to do Unicode to Chinese are organized into topic(s).

Method

StringUnicodeTochinese(String dataStr)
Unicode Tochinese
int index = 0;
StringBuffer buffer = new StringBuffer();
while (index < dataStr.length()) {
    if (!"\\u".equals(dataStr.substring(index, index + 2))) {
        buffer.append(dataStr.charAt(index));
        index++;
        continue;
    String charStr = "";
    charStr = dataStr.substring(index + 2, index + 6);
    char letter = (char) Integer.parseInt(charStr, 16);
    buffer.append(letter);
    index += 6;
return buffer.toString();
StringunicodeToChinese(String str)
unicode To Chinese
if (str != null) {
    return new String(str.getBytes("ISO-8859-1"), "GBK");
} else {
    return null;
StringunicodeToChinese(String unicode)
unicode To Chinese
StringBuilder out = new StringBuilder();
if (!isEmpty(unicode)) {
    for (int i = 0; i < unicode.length(); i++) {
        out.append(unicode.charAt(i));
return out.toString();
StringunicodeToGB2312StrWeb(String str)
unicode To GB Str Web
String s = null;
if (str != null) {
    try {
        String s1 = new String(str.getBytes("GB2312"));
        s = convertHexStr(s1);
    } catch (Exception e) {
        s = null;
return s;