The standard allows for space to be encoded as either %20 (the hex value) or '+'. The server on the other side will decode the URL properly.
Tim Davidson wrote:
Hi
I have a java class which calls a JSP page using the URLConnection class, I construct the URL e.g.
new URL("http://localhost:8080/mywebapp.index.jsp?name=fred smith");
I want to encode the string as a URL, i.e.
"http://localhost:8080/mywebapp.index.jsp?name=fred%20smith"
how can I do this?
URLEncoder doesnt seem to work as it puts '+' where the spaces should be, and the URL class doesnt do it for you either.
many thanks in advance.
=========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant archives, FAQs and Forums on JSPs can be found at:
http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com
