# `convert_encoding`
New in version 1.4: The `convert_encoding` filter was added in Twig 1.4.
The `convert_encoding` filter converts a string from one encoding toanother. The first argument is the expected output charset and the second oneis the input charset:
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>{{ data|convert_encoding('UTF-8', 'iso-2022-jp') }}
</pre></div></td></tr></table>
Note
This filter relies on the [iconv](http://php.net/iconv) [http://php.net/iconv] or [mbstring](http://php.net/mbstring) [http://php.net/mbstring] extension, so one ofthem must be installed. In case both are installed, [mbstring](http://php.net/mbstring) [http://php.net/mbstring] is used bydefault (Twig before 1.8.1 uses [iconv](http://php.net/iconv) [http://php.net/iconv] by default).
### Arguments
- `to`: The output charset
- `from`: The input charset
- Twig
- Introduction
- Installation
- Twig for Template Designers
- Twig for Developers
- Extending Twig
- Twig Internals
- Deprecated Features
- Recipes
- Coding Standards
- Tags
- autoescape
- block
- do
- embed
- extends
- filter
- flush
- for
- from
- if
- import
- include
- macro
- sandbox
- set
- spaceless
- use
- verbatim
- Filters
- abs
- batch
- capitalize
- convert_encoding
- date
- date_modify
- default
- escape
- first
- format
- join
- json_encode
- keys
- last
- length
- lower
- merge
- nl2br
- number_format
- raw
- replace
- reverse
- round
- slice
- sort
- split
- striptags
- title
- trim
- upper
- url_encode
- Functions
- attribute
- block
- constant
- cycle
- date
- dump
- include
- max
- min
- parent
- random
- range
- source
- template_from_string
- Tests
- constant
- defined
- divisible by
- empty
- even
- iterable
- null
- odd
- same as