PHP: iconv Functions - Manual
PHP  
downloads | documentation | faq | getting help | mailing lists | | php.net sites | links | my php.net 
search for in the  
<hw_api->userlisticonv_get_encoding>
view the version of this page
Last updated: Thu, 15 Jul 2004

XLI. iconv Functions

�vod

This module contains an interface to iconv character set conversion facility. With this module, you can turn a string represented by a local character set into the one represented by another character set, which may be the Unicode charcter set. Supported character sets depend on the iconv implementation of your system. Note that the iconv function on some systems may not work as you expect. In such case, it'd be a good idea to install the library. It will most likely end up with more consistent results.

Since PHP 5.0.0, this extension comes with various utility functions that help you to write multilingual scripts. Let's have a look at the following sections to explore the new features.

Po�adavky

You will need nothing if the system you are using is one of the recent POSIX-compliant systems because standard C libraries that are supplied in them must provide iconv facility. Otherwise, you have to get the library installed in your system.

Instalace

To use functions provided by this module, the PHP binary must be built with the following configure line: --with-iconv[=DIR].

Note to Windows® Users: In order to enable this module on a Windows® environment, you need to put a DLL file named iconv.dll or iconv-1.3.dll (prior to 4.2.1) which is bundled with the PHP/Win32 binary package into a directory specified by the PATH environment variable or one of the system directories of your Windows® installation.

Konfigurace b�hu

Chov�n� t�chto funkc� je ovlivn�no nastaven�m parametr� v php.ini.

Tabulka 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().

Typy prost�edk�

Toto roz���en� nem� definov�n ��dn� typ prost�edku (resource).

P�eddefinovan� konstanty

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

Tabulka 2. iconv constants

NameTypeDescription
ICONV_IMPLstringThe implementation name
ICONV_VERSIONstringThe implementation version

Pozn�mka: Writing implementation-dependent scripts with these constants is strongly discouraged.

Since PHP 5.0.0, the following constants are also available:

Tabulka 3. iconv constants available since PHP 5.0.0

NameTypeDescription
ICONV_MIME_DECODE_STRICTintegerA bitmask used for iconv_mime_decode()
ICONV_MIME_DECODE_CONTINUE_ON_ERRORintegerA bitmask used for iconv_mime_decode()

Obsah
iconv_get_encoding -- Retrieve internal configuration variables of iconv extension
iconv_mime_decode_headers --  Decodes multiple MIME header fields at once
iconv_mime_decode --  Decodes a MIME header field
iconv_mime_encode --  Composes a MIME header field
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 the last occurrence of a needle within the specified range of haystack.
iconv_substr --  Cut out part of a string
iconv -- Convert string to requested character encoding
ob_iconv_handler -- Convert character encoding as output buffer handler


add a note add a note User Contributed Notes
iconv Functions
tokiee at hotmail dot com
19-Aug-2004 08:40
iconv now has been built-in, at least in PHP >= 5.0.1 for win32. You don't have to modify php.ini for this. Actually you should not. And clearly, libiconv does not need to be installed.
thierry.bo
23-Dec-2003 10:26
Windows users.

Personaly I leaved all php dlls in \php\dlls\ directory, just adding this path to my system path, and iconv.dll supplied with php 4.3.2 works fine, also leaving supplied php_iconv.dll in my \php\extensions\ directory. This was working fine with Apache and Omnihttpd server I use.

As soon I installed IIS on the same server, php complained about not finding php_iconv.dll in the extensions directory. In fact PHP with IIS loads all extensions in my \php\extensions directory correctly, except php_iconv.dll.
Although iconv.dll is in my system path, the only way to load php_iconv.dll was to copy iconv.dll file in \%winnt\system32 directory. With other servers, iconv.dll can be in anywhere in the system path.
ALecFFer
07-Nov-2003 12:10
To windows users:

Download here iconv version 1.9.1:
14-Sep-2002 12:23
I'm not sure how recent version of
glibc 2.x Slackware 7.x/8.x comes with, but
it's very likely that it comes with glibc 2.2.x.
In that case, you don't have to bother at all to
install libiconv in /usr/local. iconv(3) in glibc 2.2.x
is very good (thanks to Ulrich Drepper and
Bruno Haible. the latter is the author of libiconv).
libiconv is very handy for those outdated/non-standard-compliant Unix
and non-Unix systems that don't have
sufficiently good iconv(3) in their C library.
elk at NOSPAMmodel-fx dot com
26-Jul-2002 04:07
If you use the libiconv library instead of the libc's iconv support, don't forget to use libiconv() instead of iconv()
elk at NOSPAMmodel-fx dot com
25-Jul-2002 03:39
To compile libiconv under Slackware 7.0 or 8.0 without errors (either with the apache module of PHP or the CGI version), you must specify the full path of the libiconv installation.

Exemple :

       --with-iconv=/usr/local

<hw_api->userlisticonv_get_encoding>
 Last updated: Thu, 15 Jul 2004
show source | credits | sitemap | contact | advertising | mirror sites 
Copyright © 2001-2004 The PHP Group
All rights reserved.
This unofficial mirror is operated at: /
Last updated: Sun Nov 14 23:09:54 2004 Local time zone must be set--see zic manual page