To clarify what Greg said, a space is not an allowed character in a URL. If your code is sending URLs with unescaped spaces in them, then you have a bug, which I'd strongly encourage you to fully fix. If all you did was special-case this one character (a space), you're quite likely to run into more issues when you have URLs with other disallowed characters like question marks, hash signs, parentheses, etc. It's true that some services (including ours) will try to guess at the meaning of the invalid URL you're sending, but relying on this seems like a bad idea.
See RFC 2396 for the details on how URLs needs to be escaped, but also consider just using the java.net.URI class, which I believe will handle all the escaping for you.