Unicode Functions
簡介
Unicode Support.
Warning
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.
執行時期設定
這些函式的行為受 php.ini 的影響。
Name | Default | Changeable | Changelog |
---|---|---|---|
unicode.fallback_encoding | NULL | PHP_INI_ALL | Available since PHP 6.0.0. |
unicode.from_error_mode | "2" | PHP_INI_ALL | Available since PHP 6.0.0. |
unicode.from_error_subst_char | "3f" | PHP_INI_ALL | Available since PHP 6.0.0. |
unicode.http_input_encoding | NULL | PHP_INI_ALL | Available since PHP 6.0.0. |
unicode.output_encoding | NULL | PHP_INI_ALL | Available since PHP 6.0.0. |
unicode.runtime_encoding | NULL | PHP_INI_ALL | Available since PHP 6.0.0. |
unicode.script_encoding | NULL | PHP_INI_ALL | Available since PHP 6.0.0. |
unicode.semantics | "0" | PHP_INI_SYSTEM | Available since PHP 6.0.0. |
以下是設定選項的簡要解釋。
- unicode.output_encoding string
-
Default encoding for output.
預設常數
以下常數由擴充功能定義,因此只有在擴充功能被編譯到 PHP 中,或者在執行時被動態載入後才有效。
constant | value | description |
---|---|---|
U_INVALID_STOP | 0 | stop at first invalid character |
U_INVALID_SKIP | 1 | skip invalid characters |
U_INVALID_SUBSTITUTE | 2 | replace invalid characters |
U_INVALID_ESCAPE | 3 | escape invalid characters |
Table of Contents
- unicode_decode — Convert a binary string into a Unicode string
- unicode_encode — Convert a unicode string in any encoding
- unicode_get_error_mode — Get the error mode for strings conversions
- unicode_get_subst_char — Get the substitution character for string conversion errors
- unicode_semantics — Check whether unicode semantics is enabled
- unicode_set_error_mode — Set the error mode for strings conversions
- unicode_set_subst_char — Set the substitution character for string conversion errors