服务器 red hat 9.0 ,tomcat客户端 windows xp ,IE在客户端上传文件,文件名为汉字,通过程序上传到linux上,然后在通过另外的网页打开上传的文件,这时读取的文件名是乱码。在linux上看到的文件名就已经是乱的了,这个问题该如何解决?请大家帮忙~!!最好提供源代码~谢谢了~

解决方案 »

  1.   

    request.setCharacterEncoding("gb2312");
    加上这句试试!
      

  2.   

    request和response的编码设置一致
      

  3.   

    jsp页面保存到数据库有乱码解决方法Jsp+tomcat+bean中文乱码问题解决方法javabean中参数有乱码
    1) 所有的jsp页面指定字符编码方式,如:Charest=gb2312,Charest=UTF-8等等
    2) 在应用服务器中的server.xml方件中找到设置服务器端口的行,一般是这样开头:”<Connector port="8080"”,
    3) 在找到的行"<Connector"开头的字符串后加上:URIEncoding="UTF-8" ,保存文件
    --------------------------------------------------------------------------
    jsp页面有乱码解决方法    所有的jsp页面指定字符编码方式,如:Charest=gb2312,Charest=UTF-8等等
        <%@ page contentType="text/html; charset=UTF-8">
    --------------------------------------------------------------------------
    jsp单个中文参数乱码解决方法    用这个转换一下: 
        <%!String trans(String chi)
           {
            string result =null;
            byte temp[];
            temp=chi.getBytes("iso=8859-1");
            result= new String(temp);
            }
        %>
    或者直接这样:
        <% 
          request.setCharacterEncoding("UTF-8");
          out.println(request.getParameter("参数ID")
        %>
    --------------------------------------------------------------------------