we have some code that gets a URL parameter value:
String savedSearchName = context.getExternalContext().getRequestParameterMap().get("name");
the URL looks like this:
http://localhost:9001/pages/listTRs.jsf?a=li&name=testsøk1
so even though the parameter looked like it had the right norwegian encoding (testsøk1), when we got the parameter value for "name", in java, the String savedSearchName had the following value:
testsøk1
to fix this we had to change the following file:
/path/to/jboss/server/mydomain/deploy/jboss-web.deployer/server.xml
and add a URIEncoding attribute to the <Connector> tag for the HTTP/1.1 protocol:
<Service name="jboss.web">
<Connector port="9001"
address="${jboss.bind.address}"
URIEncoding="UTF-8"
maxThreads="250"
maxHttpHeaderSize="8192"
emptySessionPath="true"
protocol="HTTP/1.1"
enableLookups="false"
redirectPort="8443"
acceptCount="100"
connectionTimeout="20000"
disableUploadTimeout="true" />
...
</service>
you have to restart your jboss sever for the change to take effect. after restart, the norwegian characters were correct in java:
testsøk1
IT, computer and programming tutorials and tips that i couldnt find anywhere else using google, from my daily work as a Senior Developer of solutions using Java and Linux.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment