when i submit a form in my web application some characters (f.e. german umlauts) are broken, when they enter my controller. strings like üäö
endup like üäö
. how do i fix this problem?
my setup looks like this:
- spring mvc 3.1.2
- maven 3.0.4 or 2.2.1 (tried both)
- tomcat 7.0.x
- eclipse (sts 3.1.0)
- windows 8
based on answers i already found on stackoverflow i have tried following things.
added those lines to jsp's:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
...
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
spcified encoding in pom.xml:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
<plugin>
changes the encoding in eclipse to UTF-8.
while investigating the problem i made following observations.
- when i right-click files in project (resources and java files) and check the specified encoding, it says UTF-8.
- when i output those characters in jsps(f.e.
<p>öäü</p>
) they are displayed correctly in the browser. - the problem is present in windows and linux.
thx in advance for your answers.
UPDATE:
soleved my issue by adding the CharacterEncodingFilter to my web.xml