This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Tomcat and the fly likes How to make SendRedirect to work without setting URIEncoding= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How to make SendRedirect to work without setting URIEncoding="UTF-8" in tomcat server.xml" Watch "How to make SendRedirect to work without setting URIEncoding="UTF-8" in tomcat server.xml" New topic
Author

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

sarada bokka
Ranch Hand

Joined: Jan 13, 2010
Posts: 80
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

Joined: Oct 27, 2005
Posts: 19655
    
  18

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
sarada bokka
Ranch Hand

Joined: Jan 13, 2010
Posts: 80
Thanks for your inputs
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to make SendRedirect to work without setting URIEncoding="UTF-8" in tomcat server.xml
 
Similar Threads
Unicode convert problem with Jboss in Linux
character encoding problem
URI Encoding
URIENcoding in server.xml not working in IE6
chinese characters become funny characters