/** * URL-encodes only the whitespace characters in a URL (necessary for some * faulty incomplete encodings). * @param URL the url to encode * @return encoded url */ public static String deSpace(String URL) { CharWrap togo = new CharWrap(URL.length()); for (int i = 0; i < URL.length(); ++ i) { char c = URL.charAt(i); if (Character.isWhitespace(c)) { URLEncoder.appendURLHex(c, togo); } else togo.append(c); } return togo.toString(); }