]> git.immae.eu Git - github/wallabag/wallabag.git/blob - vendor/twig/twig/doc/filters/convert_encoding.rst
twig implementation
[github/wallabag/wallabag.git] / vendor / twig / twig / doc / filters / convert_encoding.rst
1 ``convert_encoding``
2 ====================
3
4 .. versionadded:: 1.4
5 The ``convert_encoding`` filter was added in Twig 1.4.
6
7 The ``convert_encoding`` filter converts a string from one encoding to
8 another. The first argument is the expected output charset and the second one
9 is 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
21 Arguments
22 ---------
23
24 * ``from``: The input charset
25 * ``to``: The output charset
26
27 .. _`iconv`: http://php.net/iconv
28 .. _`mbstring`: http://php.net/mbstring