0

I'm using spring MVC, and I've got a problem in a webpage with a table that is showing some records that could have some special characters as Á, ñ, #, @, etc.

In the database they are stored ok. While debugging, it's taken them right from database. But when showing them at the JSP, it's replacing the special chars with "?" (question marks).

I can solve this issue with the following config at my web.xml:

<jsp-config>
    <jsp-property-group>
        <url-pattern>*.jsp</url-pattern>
        <page-encoding>UTF-8</page-encoding>
    </jsp-property-group>
</jsp-config>

But when I set this, then there're some problems with functionalities that were working before: the files I upload to my web are not encoded properly, and there are some "hardcoded" properties in my jsps like

<option value="name">Seleccione tipo de ordenación</option>

which are not properly written. With this jsp-config out then they (this option and the file upload) worked ok.

So, if I set this jsp-config property, then it fails with things that were working before.

Any help? Thanks!

4

1 回答 1

0

好吧,最后,我似乎被愚弄了 :) 我被告知该名称已正确存储到数据库中。但实际上,并非如此。问题是在用户上传文件时解码文件。该文件本身是一个 ZIP 文件,我必须使用 Apache commons compress 解压缩。我用 Cp437 打开文件,当文件在英文 Windows 系统中创建时,它运行良好。但是,在西班牙 Windows 系统中创建文件时,打开文件时失败。

如下更改 Cp850 字符集已解决问题:

zipFile = new ZipFile(f, "Cp850");
于 2013-06-06T13:49:46.697 回答