GSP 的 Grails 编码问题

发布于 2024-09-09 00:36:16 字数 441 浏览 5 评论 0 原文

我在使用 groovy 服务器页面(gsp)时遇到问题,其中 utf-8 字符未正确显示,而是显示为“?”。这发生在像“${}”这样的grails 标签内。

示例:

<p>Não</p>  --> output browser: Não - OK

<g:link title="Avaliação Relatório"....> output browser: Avaliaç?o Relat?rio

${value? "Sim" : "Não"}  output browser: N?o

gsp 已采用 UTF-8 格式。我的 grails 版本是 1.2 M3,在 localhost 中字符显示正常,但在服务器(tomcat)中则不然。

认为这是版本问题,我升级到1.3.3,问题仍然发生,但现在也在本地主机上。

I'm having trouble with groovy server pages (gsp) where utf-8 chars are not showing propertly, and instead displaying as "?". This occurs inside grails tags like "${}".

Example:

<p>Não</p>  --> output browser: Não - OK

<g:link title="Avaliação Relatório"....> output browser: Avaliaç?o Relat?rio

${value? "Sim" : "Não"}  output browser: N?o

The gsp already are in UTF-8. My grails version is 1.2 M3 and in localhost the chars are showing ok, but in server (tomcat) they are not.

Thinking that was version problem, I upgraded to 1.3.3 and the problem still happens, but now on localhost too.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

莫言歌 2024-09-16 00:36:17

我没有给你一个明确的解决方案,但我怀疑你应该看看 此处。我遇到了瑞典字符未在 ${} 中显示的问题,但那是因为我设置了...

grails.views.default.codec = 'html'

...这在我的 Javascript 中不起作用。该配置或...

grails.views.gsp.encoding

...可能会给您提供所需的线索。希望你能找到它!

I don't have a definitive solution for you, but I'm suspecting you should have a look here. I had problems with Swedish characters not showing in ${}, but that was because I had set...

grails.views.default.codec = 'html'

...which didn't work in my Javascript. That config or...

grails.views.gsp.encoding

...might give you the clue you need. Hope you find it!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文