0

I've been looking all the internet to find how i could fix my encoding problem... I don't know why but when i post data with a the data that a receive with my servlet have a encoding problem with characters like "é" or "è".

But when i put them in my database en get them from them in my servlet there is no problem.

In all my jsp files i have got this line to specify that i use UTF-8 :

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

And to get my data from my form i use this line :

String justificatif = request.getParameter("justificatif");
System.out.println(justificatif);

I've tried to modify my tomcat server files (conf/server) transforming this

<Connector port="8080" ...

to this

<Connector port="8080" ... URIEncoding="UTF-8"/>

but i doesn't affect anything

I don't know what to do, can someone help me ?

Antoine Grenard
  • 1,712
  • 3
  • 21
  • 41
  • You can try using the Request.setEncoding("UTF-8") method, though you've already tried changing your server.xml. Do you run Tomcat behind a web server ? – dsp_user May 17 '16 at 11:40

1 Answers1

0

Thx man for the answer !

In my servlet before getting my data i've just call this method :

request.setCharacterEncoding("UTF-8");
String justificatif = request.getParameter("justificatif");
System.out.println(justificatif);
Antoine Grenard
  • 1,712
  • 3
  • 21
  • 41