4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 use Symfony\Polyfill\Iconv as p;
14 if (!function_exists('iconv')) {
15 define('ICONV_IMPL', 'Symfony');
16 define('ICONV_VERSION', '1.0');
17 define('ICONV_MIME_DECODE_STRICT', 1);
18 define('ICONV_MIME_DECODE_CONTINUE_ON_ERROR', 2);
20 function iconv($from, $to, $s) { return p\Iconv::iconv($from, $to, $s); }
21 function iconv_get_encoding($type = 'all') { return p\Iconv::iconv_get_encoding($type); }
22 function iconv_set_encoding($type, $charset) { return p\Iconv::iconv_set_encoding($type, $charset); }
23 function iconv_mime_encode($name, $value, $pref = null) { return p\Iconv::iconv_mime_encode($name, $value, $pref); }
24 function iconv_mime_decode_headers($encodedHeaders, $mode = 0, $enc = null) { return p\Iconv::iconv_mime_decode_headers($encodedHeaders, $mode, $enc); }
26 if (extension_loaded('mbstring')) {
27 function iconv_strlen($s, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strlen($s, $enc); }
28 function iconv_strpos($s, $needle, $offset = 0, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strpos($s, $needle, $offset, $enc); }
29 function iconv_strrpos($s, $needle, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strrpos($s, $needle, 0, $enc); }
30 function iconv_substr($s, $start, $length = 2147483647, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_substr($s, $start, $length, $enc); }
31 function iconv_mime_decode($encodedHeaders, $mode = 0, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_decode_mimeheader($encodedHeaders, $mode, $enc); }
33 if (extension_loaded('xml')) {
34 function iconv_strlen($s, $enc = null) { return p\Iconv::strlen1($s, $enc); }
36 function iconv_strlen($s, $enc = null) { return p\Iconv::strlen2($s, $enc); }
39 function iconv_strpos($s, $needle, $offset = 0, $enc = null) { return p\Iconv::iconv_strpos($s, $needle, $offset, $enc); }
40 function iconv_strrpos($s, $needle, $enc = null) { return p\Iconv::iconv_strrpos($s, $needle, $enc); }
41 function iconv_substr($s, $start, $length = 2147483647, $enc = null) { return p\Iconv::iconv_substr($s, $start, $length, $enc); }
42 function iconv_mime_decode($encodedHeaders, $mode = 0, $enc = null) { return p\Iconv::iconv_mime_decode($encodedHeaders, $mode, $enc); }