自己可以根据你的现实需要来进行对输出的String来进行中文编码的处理!

解决方案 »

  1.   

    String aa="中文内容";
    aa=new String(aa.getBytes("ISO-8859-1"),"GB2312");
      

  2.   

    public String getStr(String str)
    {
    try
    {
    if (str == null)
    {
    return "-";
    }
    String temp_p=str;
    String temp="";
    temp=new String(temp_p.getBytes("ISO8859_1"),"GBK").trim();
    //return temp;
    return temp_p;
    }
    catch(Exception e)
    {
    System.out.println("get str exception: " + e.toString());
    return "null";
    }
    }
      

  3.   

    String aa="中文内容";
    aa=new String(aa.getBytes("ISO8859_1");
      

  4.   

    在类中写这两个方法中的任一个,调用就可以啦!public static String getGbcode(String str)
    {
    if(str == null)
    return ""; try
    {
    byte[]bytesStr = str.getBytes("ISO-8859-1");
    return new String(bytesStr,"GBK");
    }
    catch(Exception ex)
    {
    return str;
    }
    } public static String getUnicode(String str)
    {
    if(str == null)
    return ""; try
    {
    byte[]bytesStr = str.getBytes();
    return new String(bytesStr,"ISO-8859-1");
    }
    catch(Exception ex)
    {
    return str;
    }
    }
      

  5.   

    UTF-8,我在一本书上看到,也是这样说的,但不知道为什么,谁能解释解释啊!
      

  6.   

    深入剖析Java编程中的中文问题及建议最优解决方法:
    http://dev.csdn.net/develop/article/27/27140.shtm
    http://dev.csdn.net/develop/article/27/27142.shtmJava 繁体中文处理完全攻略(蔡学镛)
    http://www.csdn.net/develop/author/cxy/java_big5_1.shtm
    http://www.csdn.net/develop/author/cxy/java_big5_2.shtm