aspose file tools*
The moose likes Servlets and the fly likes Reading UTF8 form input in a sevlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Reading UTF8 form input in a sevlet" Watch "Reading UTF8 form input in a sevlet" New topic
Author

Reading UTF8 form input in a sevlet

Ezra Simon
Greenhorn

Joined: Sep 18, 2004
Posts: 9
Hi,

I have two systems - I am porting the app from one to the other....

SYSTEM 1 - works perfectly
Mac OSX (unix)
Tomcat 4.x (standalone)
Java 1.3.x

SYSTEM 2 - servlets not correctly reading UTF8 form input
RHEL 9.x
Tomcat 5.x (though apache mod_jk)
Java 1.4.x


Reading parameter off the url as follows:

http://www.someurl.com?test=%E3%81%97

And in the servlet:

request.setCharacterEncoding("UTF-8");
String test = (String)request.getParameter("test");

(tshould read the japanese hirigana character for shi)

The above works on system 1 but not on system 2. System 2 is able to read UTF-8 from a file, and write UTF to a page, but it cannot read in from a URL. It is very strange. My best guess is that there is some system property I need to set, or there is something I need to do with java 1.4 that I am not doing.

Any help is greatly appreciated.

Jon
[ April 21, 2005: Message edited by: Ezra Simon ]
Jeffrey Spaulding
Ranch Hand

Joined: Jan 15, 2004
Posts: 149
So what _is_ it you get.

Answering a question can sometimes be so easy when you get to know the complete question.
Ezra Simon
Greenhorn

Joined: Sep 18, 2004
Posts: 9
Hi,

I solved this actually. It is an issue of the connector configuration in tomcat. Details are here...

http://jakarta.apache.org/tomcat/faq/printer/connectors.html#utf8

Jon
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading UTF8 form input in a sevlet