Form character encoding problems with special characters

Posted by Enrique on Stack Overflow See other posts from Stack Overflow or by Enrique
Published on 2010-04-24T18:25:09Z Indexed on 2010/04/24 18:33 UTC
Read the original article Hit count: 253

Filed under:
|
|
|
|

Hello I have a jsp with an html form.

I set the content type like this:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>

When I send special characters like á é í ó ú they are saved correctly in the database. My table charset is utf-8.

I want to change iso-8859 to utf-8 like this to standardize my application and accept more special characters:

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>

but when I change it to utf-8 the special characters á é í ó ú are not saved correctly in the databse. When I try to save á it is saved as á

In the server side I'm using Spring MVC. I'm getting the text field value like this:

String strField = ServletRequestUtils.getStringParameter(request,
                    "field");

© Stack Overflow or respective owner

Related posts about html

Related posts about forms