0

my web app has an encoding problem. At the beggining I thought the problem is database encoding but then I debbugged my servlets. As follows: JSP page contains a form where user passes a word which has polish characters e.g "Poniedziałek", then I'm debbuging my servlet which receives this parameter and passes it to variable. Result in variable is "PoniedziaÅek".

Encoding in my JSP files is set to UTF-8

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">

I also tried to set encoding in servlet using

request.setCharacterEncoding( "UTF-8" );

Didn't work for me. What can cause this problem?

EDIT: Headers from browser read at servlet: Header Name: host, Header Value: localhost:8080
Header Name: user-agent, Header Value: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0
Header Name: accept, Header Value: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Header Name: accept-language, Header Value: pl,en-us;q=0.7,en;q=0.3
Header Name: accept-encoding, Header Value: gzip, deflate
Header Name: referer, Header Value: MY APP ADDRESS
Header Name: cookie, Header Value: JSESSIONID=768FC60090233C4DBB9A2E55B4341D32

eBEER
  • 31
  • 3
  • 7
  • Have you had a look at the headers - what is the browser saying in the request headers. You may need a filter to force the encoding on the incoming request, tomcat has a [built in one](http://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#Set_Character_Encoding_Filter). – Boris the Spider Feb 17 '13 at 16:39
  • I added the headers above. I've read them at servlet. Browser: Firefox. – eBEER Feb 17 '13 at 17:13