|
| 1 | +.. index:: |
| 2 | + single: Polyfill |
| 3 | + single: Iconv |
| 4 | + single: Components; Polyfill |
| 5 | + |
| 6 | +The Symfony Polyfill / Iconv Component |
| 7 | +====================================== |
| 8 | + |
| 9 | + This component provides a native PHP implementation of the ``iconv_*`` |
| 10 | + functions to users who run PHP versions without the ``iconv`` extension. |
| 11 | + |
| 12 | +Installation |
| 13 | +------------ |
| 14 | + |
| 15 | +.. code-block:: terminal |
| 16 | +
|
| 17 | + $ composer require symfony/polyfill-iconv |
| 18 | +
|
| 19 | +Alternatively, you can clone the `<https://github.com/symfony/polyfill-iconv>`_ repository. |
| 20 | + |
| 21 | +.. include:: /components/require_autoload.rst.inc |
| 22 | + |
| 23 | +Usage |
| 24 | +----- |
| 25 | + |
| 26 | +Once this component is installed in your application, you can use the following |
| 27 | +constants and functions, no matter if the `PHP iconv extension`_ is installed or |
| 28 | +not in your server. The only function not implemented in this component is |
| 29 | +:phpfunction:`ob_iconv_handler`. |
| 30 | + |
| 31 | +Provided Constants |
| 32 | +~~~~~~~~~~~~~~~~~~ |
| 33 | + |
| 34 | +* ``ICONV_IMPL`` (value = ``'Symfony'``) |
| 35 | +* ``ICONV_VERSION`` (value = ``'1.0'``) |
| 36 | +* ``ICONV_MIME_DECODE_STRICT`` (value = ``1``) |
| 37 | +* ``ICONV_MIME_DECODE_CONTINUE_ON_ERROR`` (value = ``2``) |
| 38 | + |
| 39 | +Provided Functions |
| 40 | +~~~~~~~~~~~~~~~~~~ |
| 41 | + |
| 42 | +These functions are always available: |
| 43 | + |
| 44 | +* :phpfunction:`iconv` |
| 45 | +* :phpfunction:`iconv_get_encoding` |
| 46 | +* :phpfunction:`iconv_set_encoding` |
| 47 | +* :phpfunction:`iconv_mime_encode` |
| 48 | +* :phpfunction:`iconv_mime_decode_headers` |
| 49 | + |
| 50 | +These functions are only available when the ``mbstring`` or the ``xml`` |
| 51 | +extension are installed: |
| 52 | + |
| 53 | +* :phpfunction:`iconv_strlen` |
| 54 | +* :phpfunction:`iconv_strpos` |
| 55 | +* :phpfunction:`iconv_strrpos` |
| 56 | +* :phpfunction:`iconv_substr` |
| 57 | +* :phpfunction:`iconv_mime_decode` |
| 58 | + |
| 59 | +.. _`PHP iconv extension`: https://secure.php.net/manual/en/book.iconv.php |
| 60 | +.. _`mbstring`: https://secure.php.net/manual/en/book.mbstring.php |
| 61 | +.. _`xml`: https://secure.php.net/manual/en/book.xml.php |
0 commit comments