System.out.println(new String(getStr(mytest),"utf-8"));

解决方案 »

  1.   

    System.out.println(new String(getStr(mytest).getBytes(), "utf-8"));
      

  2.   

    学学使用 native2ascii 工具吧。
      

  3.   

    String mytest="三个字";
    System.out.println(new String(getStr(mytest).getBytes(), "utf-8"));我试了下输出的还是乱码啊.
      

  4.   

    String temp=new String(temp_t,"Gb2312");
    try this
      

  5.   

    public String getStr(String str){
      try{
          String temp_p=str;
          byte[] temp_t=temp_p.getBytes("GB2312");
                   //or byte[] temp_t=temp_p.getBytes("GBK");
          String temp=new String(temp_t);
          return temp;
      }catch(Exception e){
       System.err.println(e);
      }
      return "null";
      }
    ///////////////////////////////////////////////////////////////////
    System.out.println(t.getStr("中文问"));
      

  6.   

    to:听风看雨byte[] temp_t=temp_p.getBytes("GB2312");
    byte[] temp_t=temp_p.getBytes("ISO-8859-1");如果我用GB2312,ISO-8859-1我的服务器就不管是偶数还是奇数都是乱码.好不容易试得了UTF-8能输出几个中文了,结果又只能是偶数个的,真搞不明白了:(