URL中的%...怎么转换成中文...
谢谢!!!
String gbk=URLDecoder.decode("%E6%8E%A5%E5%8F%97%E7%9A%84%E6%96%87%E4%BB%B6.txt","UTF");
转换成的不对...
谢谢!!!

解决方案 »

  1.   

    public static String gb2iso(String str) {
        if (str != null) {
          byte[] tmpbyte = null;
          try {
            tmpbyte = str.getBytes("GBK");
          }
          catch (Exception e) {
            System.out.println("Error: Method: dbconn.gb2iso :" + e.getMessage());
          }
          try {
            str = new String(tmpbyte, "ISO8859_1");
          }
          catch (Exception e) {
            System.out.println("Error: Method: dbconn.gb2iso :" + e.getMessage());
          }
        }
        else
          str = "";
        return str;
      }
      public static String iso2gb(String str) {
        if (str != null) {
          byte[] tmpbyte = null;
          try {
            tmpbyte = str.getBytes("ISO8859_1");
          }
          catch (Exception e) {
            System.out.println("Error: Method: dbconn.iso2gb :" + e.getMessage());
          }
          try {
            str = new String(tmpbyte, "GBK");
          }
          catch (Exception e) {
            System.out.println("Error: Method: dbconn.gb2iso :" + e.getMessage());
          }
        }
        else
          str = "";
        if (str == null)
          str = "";
        return str;
      }
      

  2.   

    String gbk=URLDecoder.decode("%E6%8E%A5%E5%8F%97%E7%9A%84%E6%96%87%E4%BB%B6.txt","UTF-8");
      

  3.   

    楼主你的方法是对的,正象 yingge(盼胖) 所写的,你在转码的时候把UTF-8写成UTF了