In Drupal 8 it was possible to decode HTML special characters in Twig using convert_encoding('UTF-8', 'HTML-ENTITIES')
as this filter relied on mbstring extension.
However it is not possible anymore in Drupal 9 as it relies on iconv instead, and the mentioned filter throws an error:
Notice: iconv(): Wrong charset, conversion from `HTML-ENTITIES' to `UTF-8' is not allowed in twig_convert_encoding()
This module provides a new Twig filter htmlspecialchars_decode
for Drupal 9 which does the same job (basically runs htmlspecialchars_decode() against the text).
Supporting organizations:
Project information
- Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed. - Maintenance fixes only
Considered feature-complete by its maintainers. - 143 sites report using this module
- Created by Alex Bukach on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.