Edit on GitHub
Jump to docs navigation

Twig Components / Methods / convert_encoding

convert_encoding(to, from) is a Twig filter to convert a string from one encoding to another. The first argument is the expected output charset, and the second one is the input charset:

{{ data|convert_encoding('UTF-8', 'iso-2022-jp') }}


This filter relies on the iconv extension.


  • to: The output charset
  • from: The input charset

Source: Twig

Edit this page on GitHub
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.