package com; import java.io.UnsupportedEncodingException; public class Charcode { public Charcode(){ } public String toString(String str){ String text = ""; if(str != null && !"".equals(str)){ try { text = new String(str.getBytes("ISO-8859-1"),"GB18030"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } return text; } }