• Post Reply Bookmark Topic Watch Topic
  • New Topic

Trouble in handling Internationalization  RSS feed

 
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I receive the http request in my servlet and since I have to provide support for kanji characters etc. before any processing I am converting the received request string into UCS encoded string with the bytes using UTF-8 encoding
like,
String ucsString = new String(_req.getParameter("string").getBytes(),"UTF-8");
But this works fine if I receive request from a browser having default encoding as "UTF-8" and it fails if the browser is having an encoding Western Europian "ISO" and surprisingly the _req.getParameter("string") only returns me correct string.
My application is in NT machine and jdk1.3
I am writing response.setContentType("text/html; charset=UTF-8")
Can anybody help me to solve the problem as I can't force user to change its default browser encoding to UTF-8.
Thanks in advance
Varun.
 
tumbleweed and gunslinger
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure what you're trying to do...
Are you saying that you are receiving posted UTF-8, but want to send a different encoding method in response?
Also, what type of response are you sending? Just translated pages?
If so, why not utilize a resource bundle and locale objects?
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David,
My problem is solved as using response.setContentType("text/html; charset=UTF-8") , I added
<%page charset="text/html; charset=UTF-8"...%> in my jsp and the data was not lost.Thuogh I have still not understand why response.setContentType was not sufficient ...!!!

-Varun
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!