Note: This manual is provided for your convenience only - this is not the official source and may not be 100% up to date.

Unicode Functions

CLXVIII. Unicode Functions


Unicode Support.


This extension is still in development and it isn't available to public yet.


ICU 3.4 or later is required.


First you should download and install ICU:

Example 1. install ICU on Unix

./configure --disable-threads --enable-extras --enable-icuio --enable-layout
make && make install

Then checkout latest PHP and configure it --with-icu-dir=<dir> option, where <dir> was the dir to where you installed ICU. You don't need to explicitly use this option if you install ICU to a standard location.

Runtime Configuration

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

Table 1. Unicode Configuration Options

unicode.fallback_encodingNULLPHP_INI_ALLAvailable since PHP 6.0.0.
unicode.from_error_mode"2"PHP_INI_ALLAvailable since PHP 6.0.0.
unicode.from_error_subst_char"3f"PHP_INI_ALLAvailable since PHP 6.0.0.
unicode.http_input_encodingNULLPHP_INI_ALLAvailable since PHP 6.0.0.
unicode.output_encodingNULLPHP_INI_ALLAvailable since PHP 6.0.0.
unicode.runtime_encodingNULLPHP_INI_ALLAvailable since PHP 6.0.0.
unicode.script_encodingNULLPHP_INI_ALLAvailable since PHP 6.0.0.
unicode.semanticsoffPHP_INI_PERDIRAvailable since PHP 6.0.0.
For further details and definitions of the PHP_INI_* constants, see the Appendix H.

Here's a short explanation of the configuration directives.

unicode.output_encoding string

Default encoding for output.

Predefined Constants

The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.

Table 2.

U_INVALID_STOP0stop at first invalid character
U_INVALID_SKIP1skip invalid characters
U_INVALID_SUBSTITUTE2replace invalid characters
U_INVALID_ESCAPE3escape invalid characters

Table of Contents
unicode_encode -- Set encoding of a unicode string
unicode_semantics -- Check whether unicode semantics is enabled