All Products
Search
Document Center

MaxCompute:URL_DECODE

Last Updated:Mar 26, 2026

Decodes a string in application/x-www-form-urlencoded format into a standard string. This is the inverse of URL_ENCODE.

Syntax

string url_decode(string <input>[, string <encoding>])

Parameters

Parameter Required Type Description
input Yes STRING The URL-encoded string to decode. Returns null if this value is null.
encoding No STRING The character encoding for decoding %xy byte sequences. Valid values: UTF-8, GBK. Default value: UTF-8. Returns null if this value is null.

Decoding rules

url_decode applies the following transformations:

  • Letters remain unchanged.

  • Periods (.), hyphens (-), asterisks (*), and underscores (_) remain unchanged.

  • Plus signs (+) are converted to spaces.

  • %xy-formatted sequences are converted to byte values. Consecutive byte values are decoded to characters based on the encoding parameter.

  • All other characters remain unchanged.

Return value

Returns a UTF-8 encoded STRING. Returns null if input or encoding is null.

Examples

Example 1: Decode a UTF-8 encoded string (default encoding)

-- The return value is for url_decode:// (fdsf).
select url_decode('%E7%A4%BA%E4%BE%8Bfor+url_decode%3A%2F%2F+%28fdsf%29');

Example 2: Decode a GBK encoded string

-- The return value is Example for URL_DECODE:// dsf(fasfs).
select url_decode('Example+for+url_decode+%3A%2F%2F+dsf%28fasfs%29', 'GBK');

Related functions