querystring.unescape(str)


querystring.unescape() 方法对给定的 str 中的 URL 百分号编码字符进行解码。

【The querystring.unescape() method performs decoding of URL percent-encoded characters on the given str.】

querystring.unescape() 方法由 querystring.parse() 使用,通常不建议直接使用它。它之所以被导出,主要是为了在必要时允许应用代码通过将 querystring.unescape 指定为其他函数来提供替代的解码实现。

【The querystring.unescape() method is used by querystring.parse() and is generally not expected to be used directly. It is exported primarily to allow application code to provide a replacement decoding implementation if necessary by assigning querystring.unescape to an alternative function.】

默认情况下,querystring.unescape() 方法会尝试使用 JavaScript 内置的 decodeURIComponent() 方法进行解码。如果解码失败,将使用一个更安全的等效方法,该方法在遇到格式错误的 URL 时不会抛出异常。

【By default, the querystring.unescape() method will attempt to use the JavaScript built-in decodeURIComponent() method to decode. If that fails, a safer equivalent that does not throw on malformed URLs will be used.】