Write code to convert String encoding to hold Chinese
//package com.book2s; public class Main { public static void main(String[] argv) { String strOrigin = "book2s.com"; System.out.println(toChineseStr(strOrigin)); }/*from ww w.j a va2s. c om*/ public static String toChineseStr(String strOrigin) { if (strOrigin == null || strOrigin.equals("null")) { strOrigin = ""; } else { strOrigin = strOrigin.trim(); } try { strOrigin = new String(strOrigin.getBytes("ISO8859_1"), "GBK"); } catch (Exception e) { } return strOrigin; } public static String trim(String s) { try { s = s.trim(); } catch (Exception e) { e.printStackTrace(); } return s; } }