Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1363
  • Last Modified:

Cross platform web app character encoding problems

Hello Experts.

I'm currently working on an web application that runs with UTF-8 encoding.
I'm running my web application on a resin 2.0.27. My web app is a spring mvc application which receives a couple of parameters when an user invokes a servlet with a specific url. The application then asks the index, which in turn returns data for my application to present to the user.

My problem is as follows:
When specifying in my resin conf that the resin instance should run with UTF-8 character encoding characters like åäö works fine in my linux environment(firefox). But when calling the application from a windows environment(firefox, IE) all parameters which contains å ä ö gets ignored by the request object. When sending the correct utf-8 encoding(%C3%B6 instead of ö) then everything works fine.

If i don't specify UTF-8 in my resin conf then all parameters exist inte the request object but the encoding gets all wrong in the linux environment and the web application receives junk characters such as ö->ö.
But when calling the application from windows å ä ö gets iso encoded(ö -> %F6 )
and works fine.

What I'm i doing wrong, why do this problem occur?
Could you please help me figure this out.
 
0
jide85
Asked:
jide85
  • 5
  • 3
  • 3
2 Solutions
 
CEHJCommented:
>>But when calling the application from a windows environment

In what way is the application called? What's the browser interface? If it's a <form> do you specify a UTF-8 charset?
0
 
jide85Author Commented:
I'm invoking a servlet which receives the request object.
Like this
Search.do?q=städning&procedure=öppen.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
CEHJCommented:
But how is it getting that query string? It should be url-encoded. See java.net.URLEncoder
0
 
objectsCommented:
0
 
CEHJCommented:
>>When sending the correct utf-8 encoding(%C3%B6 instead of ö) then everything works fine.

That's exactly how the url *should* be encoded
0
 
jide85Author Commented:
But how is it getting that query string? It should be url-encoded. See java.net.URLEncoder
I'm not sure what you mean. Th query string is written into the web browsers search field.
A request to the web server is created with the paramaters. If a parameter=a word with å ä ö
the parameter do not get included to the request object. Why?

would suggest adding a CharacterEncodingFilter if you don't already
I have tried to impelent a filter

I have already implemented a filter to make sure that my request object get's the right encoding. What I discovered in this filter was that the parameters do not exist in the request object if they contain å ä ö. This must mean that resin is doing something with the parameters which contains åäö or?
0
 
objectsCommented:
try using firebug to look at the details of the requests and response, in particular the encoding of them and the page

0
 
CEHJCommented:
>>Th query string is written into the web browsers search field.

If you've got a search box then you have a search form presumably. Did you set the form attribute as i suggested earlier?
0
 
jide85Author Commented:
Thank you guys. What i did was that I implemented a filter which checks if the url is utf encoded.
If not then i decode the request object with ISO and encode it with UTF-8 and viola, no more
encoding issues.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 5
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now