Introduction

The url_encode filter converts a string into a URL-safe format by encoding special characters according to the percent-encoding standard. This filter is particularly useful when you need to pass dynamic parameters in links, preventing URL breaks or interpretation errors.

Example of Use

Example of how to use the url_encode filter to transform a string into a URL-appropriate format:
{% set name = "John Silva & Sons" %}

{{ name|url_encode }}

Output Example of the Code

Resultado do Filtro `json_encode`