XL. iconv functions

Introduction

This module contains an interface to the iconv library functions. The iconv library functions convert strings between various character sets encodings. The supported character sets depend on the iconv() implementation on your system. Note that the iconv() function on some systems may not work as well as you expect. In this case, you should install the libiconv library.

Requirements

Your systems standard C library must provide the iconv() function or you must have libiconv installed on your system. The libiconv library is available from http://www.gnu.org/software/libiconv/.

Installation

To be able to use the functions defined in this module you must compile your PHP interpreter using the configure line --with-iconv[=DIR].

Note to Win32 Users: In order to enable this module on a Windows environment, you must copy iconv-1.3.dll from the DLL folder of the PHP/Win32 binary package to the SYSTEM32 folder of your windows machine. (Ex: C:\WINNT\SYSTEM32 or C:\WINDOWS\SYSTEM32). Starting with PHP 4.2.1 the name changed to iconv.dll

Runtime Configuration

The behaviour of these functions is affected by settings in php.ini.

Table 1. Iconv configuration options

NameDefaultChangeable
iconv.input_encodingICONV_INPUT_ENCODINGPHP_INI_ALL
iconv.output_encodingICONV_OUTPUT_ENCODINGPHP_INI_ALL
iconv.internal_encodingICONV_INTERNAL_ENCODINGPHP_INI_ALL
For further details and definition of the PHP_INI_* constants see ini_set().

Resource Types

This extension has no resource types defined.

Predefined Constants

Since PHP 4.3.0 it is possible to identify at runtime which iconv implementation is adopted by this extension.

Table 2. iconv constants

constanttypedescription
ICONV_IMPLstringThe implementation name
ICONV_VERSIONstringThe implementation version

Note: Writing implementation-dependent scripts with these constants should be discouraged.

See Also

See also the GNU Recode functions.

Table of Contents
iconv_get_encoding -- Get current setting for character encoding conversion
iconv_mime_decode --  Decodes a mime header field
iconv_mime_encode --  Composes a mime header field with field_name and field_value in a specified scheme
iconv_set_encoding -- Set current setting for character encoding conversion
iconv_strlen --  Returns the character count of string
iconv_strpos --  Finds position of first occurrence of a needle within a haystack.
iconv_strrpos --  Finds position of last occurrence of needle within part of haystack beginning with offset
iconv_substr --  Returns specified part of a string
iconv -- Convert string to requested character encoding
ob_iconv_handler -- Convert character encoding as output buffer handler