Question

I have an app., coded with ejb3, jsf and maven, which runs on jboss 4.2.2GA

The problem I have been facing for 2 days is I cannot convert non-english characters that are added to url on runtime. For instance, there is a search textbox and a button. When a user enters a word including non-english characters, and pushes the button, it is added to the url with bad characters like %56 or &347 etc..

Is there any way to achieve what I am trying to do here? BTW, is there also any way to get over this problem on the jboss side configuration rather than application side (filters or context.xml etc..)?

Any help would be appreciated Thanks a lot, Baris

-- EDIT: I have solved this issue by using URLEncoder. When I passed the variable to the action method, I use URLEncoder in order to encode it to the right charset.

Example: Take parameter from the URL: String someString = ServletActionContext.getRequest().getParameter("someStringFromURL"); Encode the string; String encoded = URLEncoder.encode(someString, "ISO-8859-9");

Was it helpful?

Solution 2

I have solved this issue by using URLEncoder. When I passed the variable to the action method, I use URLEncoder in order to encode it to the right charset.

Example: Take parameter from the URL:

String someString = ServletActionContext.getRequest().getParameter("someStringFromURL"); 

Encode the string;

String encoded = URLEncoder.encode(someString, "ISO-8859-9");

OTHER TIPS

Find the appropriate connector element in your tomcat server.xml (deploy/jboss-web.deployer/server.xml for recent versions) and add the attribute URIEncoding with a value of UTF-8.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top