CLII. 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:

例子 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.

運行時配置

這些函數的行為受 php.ini 的影響。

表格 1. Unicode Configuration Options

NameDefaultChangeableChangelog
unicode.fallback_encodingNULLPHP_INI_ALLAvailable since PHP 6.0.0.
unicode.from_error_mode2PHP_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.
有關 PHP_INI_* 常量進一步的細節與定義參見附錄 G

以下是配置選項的簡要解釋。

unicode.output_encoding string

Default encoding for output.

預定義常量

以下常量由本增加模組定義,因此只有在本增加模組被編譯到 PHP 中,或是在運行時被動態加載後才有效。

表格 2.

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

目錄
i18n_loc_get_default -- Get the default Locale
i18n_loc_set_default -- Set the default Locale
unicode_encode -- Takes a unicode string and converts it to a string in the specified encoding