Grails请求参数编码问题在Tomcat [英] Grails request parameters encoding issue in Tomcat

查看:555
本文介绍了Grails请求参数编码问题在Tomcat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的grails应用程式无法正确解码请求参数。

My grails app will not decode request parameters correctly.

在config.groovy:

In config.groovy:


  • grails.views.gsp.encoding =UTF-8

  • converters.encoding =
    UTF-8

  • grails.views.gsp.encoding = "UTF-8"
  • grails.converters.encoding = "UTF-8"

我所有的gsp使用 contentType =text / html; charset = UTF-8,以及< meta http- equiv =Content-Typecontent =

All my gsp's use contentType="text/html; charset=UTF-8" on the page directive as well as <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> in the head element.

但是,当我收到已发布的参数时,我们可以使用text / html; charset = UTF-8/>

However, when i receive the posted parameters from the param object in my controller, the app just prints garbage...

我使用Grails 1.3.7版本部署在Tomcat 5.其他已安装的插件除了tomcat:

I'm using Grails 1.3.7 version deployed over Tomcat 5. Other installed plugins except tomcat:

hibernate 1.3.7
jquery 1.7.1
spring-security-core 1.2.6
webxml 1.4

hibernate 1.3.7 jquery 1.7.1 spring-security-core 1.2.6 webxml 1.4

编辑:从进一步的调试,我注意到,应用程序将运行良好的码头。因此我怀疑它一定是一个tomcat的问题。我的问题类似于此帖子

From further debugging, i've noticed that the app will run fine in jetty. Therefore i suspect it must be a tomcat issue. My issue is similar to this post (alas i'm not using the Shiro plugin).

任何人都可以帮助这个?

Can anyone help with this?

推荐答案

您需要向连接器元素添加 URIEncoding ='UTF-8'例如

<Connector port='8080' protocol='HTTP/1.1' connectionTimeout='20000'
           redirectPort='8443' URIEncoding='UTF-8' />

这里描述:https://wiki.apache.org/tomcat/FAQ/CharacterEncoding

这篇关于Grails请求参数编码问题在Tomcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆