Skip to content

decode_uri

解码百分号编码的 URI 文本。

语法

knap
{{ value | decode_uri }}

用法

  • 格式错误的 URI 序列会原样返回。
  • 对于数组和对象(包括来自其他过滤器、已序列化的集合),其中的字符串取值会被递归格式化,而键和非字符串取值保持不变。

示例

Unicode 文本

Data
json
{
  "value": "%E4%BD%A0%E5%A5%BD"
}
Template
knap
{{ value | decode_uri }}
Output
md
你好

空格

Data
json
{
  "value": "hello%20world"
}
Template
knap
{{ value | decode_uri }}
Output
md
hello world