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!

Goyo
  • 455
  • 1
  • 9
  • 23
  • Try this :http://stackoverflow.com/questions/374573/character-encoding-jsp-displayed-wrong-in-jsp-but-not-in-url-a-a-e-a – AllTooSir Jun 05 '13 at 17:50

1 Answers1

0

Well, finally, it seems that I'd been fooled :) I've been told that the name was stored properly into the database. But, actually, it wasn't. The problem was when decoding the file when the user uploads it. The file itself is a ZIP file which I have to decompress with Apache commons compress. I was opening the file with Cp437, which was working well when the file was created in an english Windows system. However, when creating the file in an spanish Windows system, it failed when opening the file.

Changing the Cp850 charset as the following has solved the problem:

zipFile = new ZipFile(f, "Cp850");
Goyo
  • 455
  • 1
  • 9
  • 23