Java Utililty Methods GBK String Convert

List of utility methods to do GBK String Convert

Description

The list of methods to do GBK String Convert are organized into topic(s).

Method

Stringgbk2iso(String s)
gbkiso
return convertCode(s, "GBK", "ISO8859_1");
Stringgbk2Iso(String str)
gbk Iso
return new String(str.getBytes("GBK"), "iso-8859-1");
Stringgbk2Utf8(String str)
gbk Utf
try {
    return new String(str.getBytes("GBK"), "UTF-8");
} catch (UnsupportedEncodingException e) {
    e.printStackTrace();
    return str;
intgetGBKByteLength(String data)
get GBK Byte Length
if (data == null) {
    return 0;
try {
    return data.getBytes("GBK").length;
} catch (UnsupportedEncodingException e) {
    return data.getBytes().length;