Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

UTF-8 Character issue while doing request.getParameter in servlet  RSS feed

Posts: 27
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

This is regarding the issue I am facing while sending UTF-8 characters using GET method to a servlet directly from browser.
I have done the following settings:
1. Created a CharsetFilter, which sets encoding type for each request as UTF-8
2. Applied this filter in web.xml before all the requests
3. In my servlet, while writing the response, I have set response.setContentType to text/html;charset=utf-8

For the above mentioned settings accented characters like ÀÁÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ works correctly. But Chinese characters, Arabic characters etc does not work.

How ever if along with above settings, I change the server.xml settings to have useBodyEncodingForURI="true" OR/AND URIEncoding="UTF-8" in connector tag, the Chinese & Arabic characters works fine but now accented characters do not work .

I have tried all the combination of the settings mentioned but some how only one of the above two situations work.

Has anybody come across this problem? Any pointers will be great.

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!