force_escape

HTML escapes a text.

Applies HTML escaping to a string (see the filter#escape filter for details). In contrary to the escape filter, the force_escape filter is applied immediately and returns a new, escaped string. This is useful in the rare cases where you need multiple escaping or want to apply other filters to the escaped results. Normally, you want to use the filter#escape filter.

For example:

{{ value|force_escape }}

If the value is hel&lo then the output is hel&lo.

Edit on GitHub

Referred by

Filters

escape

HTML escape a text. Escapes all reserved HTML characters in the value. Escaped strings are safe to be displayed in a HTML page. When you echo a query string…

Category

Filters

Template value transformations for text, collections, dates, numbers, URLs, and other data.

Filters

unescape

Removes HTML escaping from a text.

Filters

escape_check

Ensures thant an HTML escaped value is properly escaped.