File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes URL Address Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "URL Address" Watch "URL Address" New topic

URL Address

Alan So

Joined: Sep 07, 2011
Posts: 10

I have a URL b c

When I manually enter the URL address in the browser it works.

But when I code it in java and java automatically launch the browser, my URL will become which this does not fetch the data.

Please advice. Thanks.
Ralph Cook
Ranch Hand

Joined: May 29, 2005
Posts: 479
It is not legal to have a space in a URL. The %20 represents a space in an "encoded" URL, at least in some implementations/encoding schemes. If you are actually entering "a b c" at the end in a standard browser, and it is interpreting it as a URL, it is translating it somehow.

I do not know what your actual URL is, or your browser, or why something is (as you say) working in the browser and not in your program, etc. You don't give nearly enough detail about what is actually happening, so this is as much advice as I can offer. You could look at java's standard URLEncoder class, though it doesn't seem to translate spaces to %20 any more in its default encoding.

I agree. Here's the link:
subject: URL Address
It's not a secret anymore!