This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Get encoding type of URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Get encoding type of URL" Watch "Get encoding type of URL" New topic
Author

Get encoding type of URL

Gautam Borkar
Greenhorn

Joined: Jun 02, 2011
Posts: 1
I am running into a problem with respect to URI encoding.

In tomcat server.xml, I have set URIEncoding="UTF-8" for the connector configuration. And in my servlet, there is a function which converts the request data to UTF-8.
The problem is the request data, that is passed via URL, which is in UTF-8, is re-encoded to UTF-8 and hence garbage value is seen in the jsp.

Is there a way to get the encoding type of the URL in the servlet?

I dont want to modify my server.xml file neither do I want to remove the java method that encodes the request data.
Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

I believe, using the java.nio.charset.Charset class, you may be able to find out what is the encoding scheme used.


S.D. MADHAN
Not many get the right opportunity !
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Get encoding type of URL
 
Similar Threads
arabic data from the database
request.setCharactereEncoding doesn't work on Tomcat ?
Character Encoding issue with Tomcat 5.5.9
ServletRequest object modified
UTF-8 Character issue while doing request.getParameter in servlet