0

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

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

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

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

所以我尝试:

  • charset="utf-8" 形式 => FAIL
  • AppModule中的 buildUtf8Filter => FAIL

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

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

感谢你们对我的帮助。:)

4

2 回答 2

1

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.

于 2010-08-20T07:31:42.590 回答
0

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

于 2010-08-24T11:42:50.423 回答