List of utility methods to do String to Chinese GB2312
boolean | isGB2312(char c) is GB Character ch = new Character(c); String sCh = ch.toString(); try { byte[] bb = sCh.getBytes("gb2312"); if (bb.length > 1) { return true; } catch (java.io.UnsupportedEncodingException ex) { ... |
String | toGB2312(String s) to GB if (s == null || s.length() < 1) return s; byte[] temp_b = s.getBytes("ISO-8859-1"); String sTmpStr = new String(temp_b, "GB2312"); return sTmpStr; |
String | toGB2312(String s) Encode the string to GB2312 if (s != null && s.length() > 0) { byte[] byteTmp = s.getBytes("ISO8859_1"); s = new String(byteTmp, "GB2312"); return s; |
String | toGb2312(String str) to Gb try { return new String(str.getBytes("ISO8859_1"), "GB2312"); } catch (Exception e) { return str; |