1``convert_encoding``
2====================
3
4.. versionadded:: 1.4
5    The ``convert_encoding`` filter was added in Twig 1.4.
6
7The ``convert_encoding`` filter converts a string from one encoding to
8another. The first argument is the expected output charset and the second one
9is the input charset:
10
11.. code-block:: jinja
12
13    {{ data|convert_encoding('UTF-8', 'iso-2022-jp') }}
14
15.. note::
16
17    This filter relies on the `iconv`_ or `mbstring`_ extension, so one of
18    them must be installed. In case both are installed, `mbstring`_ is used by
19    default (Twig before 1.8.1 uses `iconv`_ by default).
20
21Arguments
22---------
23
24* ``to``:   The output charset
25* ``from``: The input charset
26
27.. _`iconv`:    https://secure.php.net/iconv
28.. _`mbstring`: https://secure.php.net/mbstring
29