code: private String getValidURL(String url)
  	{
  		if (url != null && url.length() > 0)
  		{
  			// XXX really important that this one happens first!!
  			return url.replaceAll("[%]", "%25")
  				.replaceAll(" ", "%20")
  				.replaceAll("[<]", "%3c")
  				.replaceAll("[>]", "%3e")
  				.replaceAll("[\"]", "%3f")
  			.replaceAll("[#]", "%23")
  			.replaceAll("[{]", "%7b")
  			.replaceAll("[}]", "%7d")
  			.replaceAll("[|]", "%7c")
  			.replaceAll("[\\\\]", "%5c") // double check this
  													// one :-)
  			.replaceAll("[\\^]", "%5e")
  			.replaceAll("[~]", "%7e")
  			.replaceAll("[\\[]", "%5b")
  			.replaceAll("[\\]]", "%5d")
  			.replaceAll("[']", "%27")
  			.replaceAll("[?]", "%3f");
  		}
  
  		return url;
  
  	}
docs: Returns valid LDAP URL for the specified URL.
  
  @param url
  the URL to convert to the valid URL