aspose file tools*
The moose likes Servlets and the fly likes Encoding problem in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Encoding problem in servlet" Watch "Encoding problem in servlet" New topic
Author

Encoding problem in servlet

Abed Rabie
Ranch Hand

Joined: Jun 24, 2003
Posts: 74
Dear All,

I hope all of you get this mail in good health and mode. Please i need your help at some problem.

I'm developing a web site using apahce server as a web server and the site will be in a language other than English.

I'm using a db2 database.

The problem happend as it's:
1) I get the parameters from the servlet
2) I access a java bean class at the servlet which i made the connection to database in it.
3) the values didn't enter the database correctly in Arabic format.

NB.: if i write constant values of arabic in the bean class, it enters the database correctly in Arabic format.

Also I'm using the encoding "windows-1256" and I trried also "UTF-8"

So please advice and recommend a solution for me.

Looking forward to hear from u soon.

Thx and best regards

Aabed


Abed Rabie
sureshbabu
Greenhorn

Joined: Dec 09, 2004
Posts: 8
Have u tried request.setCharacterEncoding("UTF-8");
Abed Rabie
Ranch Hand

Joined: Jun 24, 2003
Posts: 74
Dear Friend,

I will try this method but is it a must to set the encoding at html and xml as "utf-8" or just the servlets only.

Thanks alot for ur care and quick reply.

Best regards

Aabed
Abed Rabie
Ranch Hand

Joined: Jun 24, 2003
Posts: 74
Dear All,

Can anyone help me to solve this problem.

Best regards

Abed
Alex Sharkoff
Ranch Hand

Joined: Apr 11, 2004
Posts: 209
Hi Abed,

Please do the following:

First operations in your doGet/doPost are


By the way this functionality can be implemented using Intercepting Filter design pattern (i.e. create your own implementation of javax.servlet.Filter, refer to the Servlet 2.4 spec's "Filtering" chapter if interested)



Alex (SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJD 1.4)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Encoding problem in servlet