This question already has an answer here:
I saw a lot of question like mine but not a single answer works...
Here's the thing : I want to get my parameters from the request (characters with accents) but it doesn't work. I tried to user request.setCharacterEncoding( "UTF-8" )
but it didn't work either.
I know that URLDecoder.decode( request.getQueryString(), "UTF-8" )
returns me the rights characters but request.getParameterValues()
doesn't work !
Does anyone have an idea ?
Thank you
Paul's suggestion seems like the best course of action, but if you're going to work around it, you don't need URLEncoder or URLDecoder at all:
Update: Since this is getting a lot of votes, I want to stress BalusC's point that this definitely is not a solution; it is a workaround at best. People should not be doing this.
I don't know exactly what caused the original issue, but I suspect the URL was already UTF-8 encoded, and then was UTF-8 encoded again.
Well, I found a way to resolve my problem, I guess that's not the better solution, but it does works..
If it can help anyone else, I'm glad to help :)
PS : Paul, I didn't answer you earlier but I already did those things. Thanks anyway for your help.
If you are using Apache Tomcat,
request.setCharacterEncoding("UTF-8")
only works withPOST
request.For
GET
request, you need addURIEncoding="UTF-8"
on your<Connector>
inserver.xml
.See more in FAQ/CharacterEncoding - Tomcat Wiki.