Adding URI.encode to parse_url method so URLs get encoded correctly