Steven De Groote
Steven De Groote

Reputation: 2233

Reading request parameter values with UTF-8 chars in JSF

I have a problem reading request paremeters from a GET request that contain special characters. Here's what I do:

I create the request url with javascript, and the value of drivername is encodeURIComponent('sorumluluğumuzu') The result is this URL, which shows up correctly in firefox: http://localhost:8080/driver/list.xhtml?sl=1&drivername=sorumlulu%C4%9Fumuzu

However, when I read the request param in my JSF bean: FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap()

The value equals to sorumluluÄumuzu

I'm experiencing this om Tomcat7 in JSF2, but we are noticing the same issue on Websphere6 and JSF1.2.

Any thoughts?

Upvotes: 2

Views: 2064

Answers (1)

BalusC
BalusC

Reputation: 1108782

Tomcat by default URL-decodes GET request parameters using ISO-8859-1. You need to change it to UTF-8 by the URIEncoding attribute in the <Connector> element of Tomcat's /conf/server.xml.

<Connector ... URIEncoding="UTF-8">

See also:

Upvotes: 2

Related Questions