• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Encoding problem in servlet

 
Abed Rabie
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
sureshbabu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have u tried request.setCharacterEncoding("UTF-8");
 
Abed Rabie
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

Can anyone help me to solve this problem.

Best regards

Abed
 
Alex Sharkoff
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic