Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to make SendRedirect to work without setting URIEncoding="UTF-8" in tomcat server.xml

 
sarada bokka
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am having URL with special characters ₤€ñ₧™Ω۞

code :
encodeUrl = URLEncoder.encode(mystrg, "UTF-8");
response.sendRedirect(encodeUrl );

After response.sendRedirect(encodeUrl ); the special characters are getting changed.
if I add the parameter URIEncoding="UTF-8" for the Connector tag in server.xml(tomcat) it is working fine!

But the requirement is not to change the server.xml. Could some let me know whether it is possible without changing server.xml file and getting the same outcome?


Regards,
Sarada.
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat must use the same encoding to decode them as you used for encoding. That means that you have two possibilities:
1) You modify the encoding for encoding to the one Tomcat uses (which probably won't work as these characters don't look like many encodings support them).
2) You modify the encoding Tomcat uses to the one you use for encoding.

You may not want to (or cannot) choose option 2, but unless you can get option 1 to work you have no other option.
 
sarada bokka
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your inputs
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic