临时解决方法为添一个uri编码转换,文件传输的过滤器

解决方案 »

  1.   

    String x = "http://www.myweb.com/信息/信息.gif"<a href=<%= java.net.URLEncode.encode(x)%>信息</a>
      

  2.   

    tmpStr:要显示的
    tmpStr1 = new String(tmpStr.getBytes("GB2312"),"ISO8859_1");
    GB2312:你想对应的中文字体
      

  3.   

    如果是html文件,又不打算用jsp改写有什么办法用tomcat跑中文名.html吗
      

  4.   


    多谢各位相助,有关中文与unicode之间转换问题以下方法可以解决
    问题是调用response.sendRedirect(urlFile)时仍提示找不到指定文件
    (urlFile:包含中文文件名的文件路径)//输出时的中文转换函数
      public String getStrOut(String string){
        try{
          String temp_p=string;
          byte[] temp_t=temp_p.getBytes("ISO8859-1");
          String temp=new String(temp_t);
          temp=(temp.equals("null"))?"":temp;
          temp=(temp==null)?"":temp;
          return temp;
        }catch(Exception e){}
        return "null";
      }//中文转换为unicode
      public String ChineseStringToAscii(String s) {
        try {
          CharToByteConverter toByte = CharToByteConverter.getConverter("gb2312");
          byte[] orig = toByte.convertAll(s.toCharArray());
          char[] dest = new char[orig.length];
          for (int i=0;i<orig.length;i++)
            dest[i] = (char)(orig[i] & 0xFF);
          return new String(dest);
        }
        catch (Exception e) {
          System.out.println(e);
          return s;
        }
      }
      //unicode转换为中文
      public static String AsciiToChineseString(String s) {
        char[] orig = s.toCharArray();
        byte[] dest = new byte[orig.length];
        for (int i=0;i<orig.length;i++)
          dest[i] = (byte)(orig[i]&0xFF);
        try {
          ByteToCharConverter toChar = ByteToCharConverter.getConverter("gb2312");
          return new String(toChar.convertAll(dest));
        }
        catch (Exception e) {
          System.out.println(e);
          return s;
        }
      }