File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes UTF-8 Character issue while doing request.getParameter in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "UTF-8 Character issue while doing request.getParameter in servlet" Watch "UTF-8 Character issue while doing request.getParameter in servlet" New topic
Author

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

parampreet sethi
Greenhorn

Joined: Aug 03, 2009
Posts: 27

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.

Thanks
Param


Param
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: UTF-8 Character issue while doing request.getParameter in servlet