added code to support spaces and percent symbols in url