你是get还是post?post一般不会啊.实在不行还有最后一招,用new String(arg.getBytes("iso-8859-1"),"utf-8")试试,arg是接过来的参数.因为浏览器用的iso-8859-1来编码的,传来之后先按这个活的字节数组,在重新编码.没源码,只能想到这些了

解决方案 »

  1.   

    ajax用post方式,我上次也遇到过。
      

  2.   

    encodeURIComponent 用这个把参数包一下 ajax参数位置
      

  3.   

    传参乱码的话,那你转码吧,我以前遇到过。
    //得到要搜索的信息并转码
         String tsearch = request.getParameter("tsearch");
                    tsearch = new String(tsearch.trim().getBytes("GBK"),"GBK");
      

  4.   

     对对 我上次也是那样 改为post就行了 
      

  5.   

    ajax用post ,用get方式,一般都会乱码···
      

  6.   

    这种问题太容易了,对汉字进行两次编码 ,用JQUERY的话一次就够了。
      

  7.   

    或者费事的转码或者添加ajax的属性、jquery在未指定字符集的时候,是使用ISO-8859-1 
    在ajax的属性添加这句:
    contentType:'application/x-www-form-urlencoded; charset=utf-8',   
    $(function(){
    $.ajax({
    type:'POST',
    url:'xxx.action',
    data:{name:"你好"},
    contentType:'application/x-www-form-urlencoded; charset=utf-8',
    success:function(data){alert(data)}
    });
    })
      

  8.   

        <filter>
    <filter-name>encodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
    <param-name>encoding</param-name>
    <param-value>UTF-8</param-value>
    </init-param>
    <init-param>
    <param-name>forceEncoding</param-name>
    <param-value>true</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    web.xml的servlet前加上过滤器 还不行 是不是数据库编码有问题 乱码大概有7种可能 LZ网上搜一下
      

  9.   

    楼主,你这个问题真是很轻易就能解决了,在<script type="text/javascript">里加上 language="javascript" encoding="utf-8"
      

  10.   

    在ajax的属性添加这句:
    contentType:'application/x-www-form-urlencoded; charset=utf-8',   
    是正解,谢谢大侠^_^