Tapestry 中的表单编码

发布于 2024-09-14 22:13:24 字数 504 浏览 6 评论 0原文

我对 Tapestry 表单有疑问。 我的XML数据库对编码非常敏感,需要utf-8。

当我将字符“à”放入表单中时,tapestry 收到“Ó”并且我的核心收到错误:3 字节 UTF-8 序列的第 2 字节无效。

我在eclipse中使用tomcat的本地默认配置没有这个问题。

但无论 tomcat 配置如何,我认为我的应用程序必须自己进行转换。

所以我尝试:

每个页面的字符集始终为 utf-8。

那么,在使用 java Charset 编码器之前我可以做什么?

谢谢你帮助我。 :)

I have a problem with Tapestry form.
My XML database is very sensible with encoding, and need utf-8.

When i put the char 'à' in my form, tapestry receive 'Ó' and my core get an error : Invalid byte 2 of 3-byte UTF-8 sequence.

I haven't the problem in eclipse with local default configuration for tomcat.

But whatever the tomcat configuration, i think my application must do the conversion itself.

So i try :

The charset of every page is always utf-8.

So, what could i do before using java Charset encoder ?

thank you for helping me. :)

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

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

发布评论

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

评论(2

不甘平庸 2024-09-21 22:13:24

我不认为你的申请有什么问题。 Tapestry 默认以 UTF-8 执行所有操作;该 wiki 页面相当过时(指的是 5.0.5 beta,显然带有文件上传的表单仍然没有正确使用 UTF-8)。

你说的是本地没有问题。您是否尝试过在不同的服务器上运行?如果那里没有问题,则服务器上操作系统的代码页设置可能有问题。

下面纯粹是轶事证据

我曾经在生产服务器(运行 SUSE Linux)上的 Tapestry 5 应用程序中遇到过类似的字符集问题,但我无法在任何其他服务器上重现。应用程序、Tomcat 服务器和系统的代码页设置似乎一切都很好,但 POST 数据最终会在应用程序中解码为 ISO 8859-1 而不是 UTF-8。在问题出现之前,该应用程序已经在该服务器上运行了一年——可能是通过操作系统的更新。

经过一天毫无进展后,我们最终重新安装了整个服务器操作系统,一切又恢复正常了。

I wouldn't think there's anything wrong with your application. Tapestry does everything in UTF-8 by default; that wiki page is fairly out of date (referring to the 5.0.5 beta, where apparently forms with file uploads still didn't use UTF-8 properly).

You're saying you don't have the problem locally. Have you tried running on a different server? If you do not have the problem there, there's probably something wrong with the codepage settings of the operating system on the server.

Purely anecdotal evidence below

I have once had a similar character set problem in a Tapestry 5 app on the production server (running SUSE Linux) that I could not reproduce on any other server. All seemed fine with the application, the Tomcat server, and the codepage settings of the system, but POST data would end up decoded as ISO 8859-1 instead of UTF-8 in the application. The app had run on that server for a year before the problem manifested - maybe through an update in the operating system.

Afer a day of not getting anywhere, we ended up just re-installing the whole server OS, and everything was fine again.

假装不在乎 2024-09-21 22:13:24

问题出在 Windows shell 中启动的 JVM 的默认字符集。
它导致 FileWriter 出现问题,然后在控制台中显示错误的字符:)

The problem was about the default charset of the JVM launched into windows shell.
It caused trouble with FileWriter and then show bad character in the console :)

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