Installation
mbstring is a non-default extension. This means it is not
enabled by default. You must explicitly enable the module
with the configure option. See the Install section for details.
The following configure options are related to the mbstring
module.
--enable-mbstring=LANG: Enable mbstring functions. This
option is required to use mbstring functions.
As of PHP 4.3.0, mbstring extension provides enhanced support
for Simplified Chinese, Traditional Chinese, Korean, and
Russian in addition to Japanese. To enable that feature,
you will have to supply either one of the following options
to the LANG parameter; --enable-mbstring=cn for Simplified
Chinese support, --enable-mbstring=tw for Traditional Chinese
support, --enable-mbstring=kr for Korean support, --enable-mbstring=ru
for Russian support, and --enable-mbstring=ja for Japanese
support.
Also --enable-mbstring=all is convenient for you to enable
all the supported languages listed above.
Note: Japanese language support is also enabled by --enable-mbstring
without any options for the sake of backwards compatibility.
--enable-mbstr-enc-trans : Enable HTTP input character
encoding conversion using mbstring conversion engine. If
this feature is enabled, HTTP input character encoding may
be converted to mbstring.internal_encoding automatically.
Note: As of PHP 4.3.0, the option --enable-mbstr-enc-trans
was eliminated and replaced with the runtime setting mbstring.encoding_translation.
HTTP input character encoding conversion is enabled when
this is set to On (the default is Off).
--enable-mbregex: Enable regular expression functions with
multibyte character support.
Runtime Configuration
The behaviour of these functions is affected by settings
in php.ini.
Table 1. mbstring configuration options
Name Default Changeable
mbstring.language "neutral" PHP_INI_SYSTEM | PHP_INI_PERDIR
mbstring.detect_order NULL PHP_INI_ALL
mbstring.http_input "pass" PHP_INI_ALL
mbstring.http_output "pass" PHP_INI_ALL
mbstring.internal_encoding NULL PHP_INI_ALL
mbstring.script_encoding NULL PHP_INI_ALL
mbstring.substitute_character NULL PHP_INI_ALL
mbstring.func_overload "0" PHP_INI_SYSTEM | PHP_INI_PERDIR
mbstring.encoding_translation "0" PHP_INI_SYSTEM
| PHP_INI_PERDIR
For the definition of the PHP_INI_* constants, please refer
to ini_set().
Here's a short explanation of the configuration directives.
mbstring.language is the default national language setting
(NLS) used in mbstring. Note that this option automagically
defines mbstring.internal_encoding and mbstring.internal_encoding
should be placed after mbstring.language in php.ini
mbstring.encoding_translation enables the transparent character
encoding filter for the incoming HTTP queries, which performs
detection and conversion of the input encoding to the internal
character encoding.
mbstring.internal_encoding defines the default internal
character encoding.
mbstring.http_input defines the default HTTP input character
encoding.
mbstring.http_output defines the default HTTP output character
encoding.
mbstring.detect_order defines default character code detection
order. See also mb_detect_order().
mbstring.substitute_character defines character to substitute
for invalid character encoding.
mbstring.func_overload overloads a set of single byte functions
by the mbstring counterparts. See Funtion overloading for
more information.
According to the HTML 4.01 specification, Web browsers are
allowed to encode a form being submitted with a character
encoding different from the one used for the page. See mb_http_input()
to detect character encoding used by browsers.
Although popular browsers are capable of giving a reasonably
accurate guess to the character encoding of a given HTML
document, it would be better to set the charset parameter
in the Content-Type HTTP header to the appropriate value
by header() or default_charset ini setting.