URL decode a string
5677
private static String URLDecode(String text) {
        String result = null;
        try {
            result = URLDecoder.decode(text, "UTF8");
        } catch (UnsupportedEncodingException e) {
            // Should never happen - all JDKs must support UTF8
            FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.WebJsMessageFactoryImpl.URLDecode", "293");
        }
        return result;
    }
1064336
function parseEncodedUrl(encodedUrl) {
  var url = '';

  for(var cChar = 0; cChar < (encodedUrl.length / 2); cChar++) {
    var charCode = parseInt(encodedUrl.substr(cChar*2,2),16);
    switch(charCode) {
      case 0x00:
        url += ".com/";
        break;
      case 0x01:
        url += ".org/";
        break;
      case 0x02:
        url += ".edu/";
        break;
      case 0x03:
        url += ".net/";
        break;
      case 0x04:
        url += ".info/";
        break;
      case 0x05:
        url += ".biz/";
        break;
      case 0x06:
        url += ".gov/";
        break;
      case 0x07:
        url += ".com";
        break;
      case 0x08:
        url += ".org";
        break;
      case 0x09:
        url += ".edu";
        break;
      case 0x0a:
        url += ".net";
        break;
      case 0x0b:
        url += ".info";
        break;
      case 0x0c:
        url += ".biz";
        break;
      case 0x0d:
        url += ".gov";
        break;
      default:
        url += String.fromCharCode(charCode);
    }
  }

  return url;
}
1007419
function decodeBase64WebPDataURL(url) {
            if (typeof url !== "string" || !url.match(/^data:image\/webp;base64,/i)) {
                return false;
            }
            
            return window.atob(url.substring("data:image\/webp;base64,".length));
        }
909975
public static function decodeURLSafe($string)
    {
        $remainder = strlen($string) % 4;

        if ($remainder <> 0) {
            $paddingLength = 4 - $remainder;
            $string .= str_repeat('=', $paddingLength);
        }

        return base64_decode(str_replace(array('-', '_'), array('+', '/'), $string));
    }
1026248
def parse_url(url, encoding=None):
    
    return url if isinstance(url, urlparse.ParseResult) else \
        urlparse.urlparse(unicode_to_str(url, encoding))
164325
function base64url_decode(input) {
    return Base64.decode(input.replace(/-/g, '+').replace(/_/g, '/'));
}
903108
def base64_url_decode(str)
      encoded_str = str.tr('-_', '+/')
      encoded_str += '=' while !(encoded_str.size % 4).zero?
      Base64.decode64(encoded_str)
    end
875954
function decode(string, tag) {

    tag = tag || '\\u';

    var newString = '';
    var open = false;
    var char, charCode;
    var index = -1;
    var length = string.length;
    while (++index < length) {
        char = string.charAt(index);
        charCode = char.charCodeAt(0);
        if (open) {
            if (char === tag) {
                newString += tag;
            } else {
                var hex = parseInt(string.substr(index, 4), 16);
                if (isNaN(hex)) {
                    newString += char;
                } else {
                    newString += String.fromCharCode(hex);
                    index += 3;
                }
            }
            open = false;
        } else {
            if (char === tag) {
                open = true;
            } else {
                newString += char;
            }
        }
    }

    return newString;

}
968869
public static String decode(String value, Charset charset) {
    try {
      /* there is nothing special between uri and url decoding */
      return URLDecoder.decode(value, charset.name());
    } catch (UnsupportedEncodingException uee) {
      /* since the encoding is not supported, return the original value */
      return value;
    }
  }
869738
function urlEncode(data) {
  log("==================================================");
  log("Data before urlEncode");
  log("==================================================");
  log(data);

  if (data === "") {
    return data;
  }

  let find = ["~", "%20", "'"];
  let replace = ["%7E", "+", "%27"];
  let encodedData = encodeURIComponent(data);

  find.forEach((encodedChar, index) => {
    let regex = new RegExp(encodedChar, "g");
    encodedData = encodedData.replace(regex, replace[index]);
  });

  log("==================================================");
  log("Data after urlEncode");
  log("==================================================");
  log(encodedData);

  return encodedData;
}
846587
@Trivial
    private static String decode(String s) {
        if (s == null) {
            return null;
        }
        return s.replace("%21", "!");
    }
76949
public function decode(string $url): string
    {
        if (\strpos($url, 'audio_api_unavailable') !== false)
        {
            $t = \explode('#', \explode('?extra=', $url)[1]);
            $n = $t[1] === '' ? '' : $this->decode_r($t[1]);
            $t = $this->decode_r($t[0]);
            if (!$t || !\is_string($t))
            {
                return $url;
            }
            $n = $n ? \explode(\chr(9), $n) : [];

            $n_len = \count($n);
            while ($n_len)
            {
                --$n_len;
                $s = \explode(\chr(11), $n[$n_len]);
                [$a, $s] = $this->splice($s, 0, 1, $t);
                $a = $a[0];
                if (!\method_exists($this, $a))
                {
                    return $url;
                }
                $t = $this->{$a}(...$s);
            }

            if (0 === \strpos($t, 'http'))
            {
                return $t;
            }
        }

        return $url;
    }
952401
public static String urlDecode(String s) {
		if (s == null) {
			return "";
		}
		String decoded = s;
		try {
			decoded = URLDecoder.decode(s, Config.DEFAULT_ENCODING);
		} catch (UnsupportedEncodingException ex) {
			logger.error(null, ex);
		}
		return decoded;
	}
522166
private static String decodeIfSpecified(String value, boolean decode) {
        return decode ? SdkHttpUtils.urlDecode(value) : value;
    }
889183
public static String urlEncode(String string) {
		try {
			return URLEncoder.encode(string, "utf-8");
		} catch (UnsupportedEncodingException e) {
			throw new RuntimeException(e);
		}
	}
655318
function decode(str) {
  var decoded = 0;

  for (i = 0; i < str.length; i++) {
    decoded = decoded * length + map[str.charAt(i)];
  }

  return decoded;
}
843928
public static String decodeUrlPath(String href, String encoding) throws UnsupportedEncodingException {
		if(href.startsWith("tel:")) return href;
		int len = href.length();
		int pos = 0;
		StringBuilder SB = new StringBuilder(href.length()*2); // Leave a little room for encoding
		while(pos<len) {
			int nextPos = StringUtility.indexOf(href, noEncodeCharacters, pos);
			if(nextPos==-1) {
				SB.append(URLDecoder.decode(href.substring(pos, len), encoding));
				pos = len;
			} else {
				SB.append(URLDecoder.decode(href.substring(pos, nextPos), encoding));
				char nextChar = href.charAt(nextPos);
				if(nextChar=='?') {
					// End decoding
					SB.append(href, nextPos, len);
					pos = len;
				} else {
					SB.append(nextChar);
					pos = nextPos+1;
				}
			}
		}
		return SB.toString();
	}