php8.5
Home/ Manual/ reference / mbstring/ mbstring configuration options

mbstring configuration options

mbstring configuration optionsNameDefaultChangeableChangelogmbstring.language"neutral"INI_ALLmbstring.detect_orderNULLINI_ALLmbstring.http_input"pass"INI_ALLDeprecatedmbstring.http_output"pass"INI_ALLDeprecatedmbstring.internal_encodingNULLINI_ALLDeprecatedmbstring.substitute_characterNULLINI_ALLmbstring.func_overload"0"INI_SYSTEM Deprecated as of PHP 7.2.0; removed as of PHP 8.0.0. mbstring.encoding_translation"0"INI_PERDIRmbstring.http_output_conv_mimetypes"^(text/|application/xhtml\+xml)"INI_ALLmbstring.strict_detection"0"INI_ALLmbstring.regex_retry_limit"1000000"INI_ALLAvailable as of PHP 7.4.0.mbstring.regex_stack_limit"100000"INI_ALLAvailable as of PHP 7.3.5. Constants

Runtime Runtime

NameDefaultChangeableChangelog
mbstring.language"neutral"INI_ALL
mbstring.detect_orderNULLINI_ALL
mbstring.http_input"pass"INI_ALLDeprecated
mbstring.http_output"pass"INI_ALLDeprecated
mbstring.internal_encodingNULLINI_ALLDeprecated
mbstring.substitute_characterNULLINI_ALL
mbstring.func_overload"0"INI_SYSTEMDeprecated as of PHP 7.2.0; removed as of PHP 8.0.0.
mbstring.encoding_translation"0"INI_PERDIR
mbstring.http_output_conv_mimetypes"^(text/|application/xhtml\+xml)"INI_ALL
mbstring.strict_detection"0"INI_ALL
mbstring.regex_retry_limit"1000000"INI_ALLAvailable as of PHP 7.4.0.
mbstring.regex_stack_limit"100000"INI_ALLAvailable as of PHP 7.3.5.

Constants

Title

mbstring.languagestring

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 Ini

mbstring.encoding_translationbool

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_encodingstring
Warning

Future

Defines the default internal character encoding.

Users should leave this empty and set default_charset instead.

mbstring.http_inputstring
Warning

Future

Defines the default HTTP input character encoding.

Users should leave this empty and set default_charset instead.

mbstring.http_outputstring
Warning

Future

Defines the default HTTP output character encoding (output will be converted from the internal encoding to the HTTP output encoding upon output).

Users should leave this empty and set default_charset instead.

mbstring.detect_orderstring

Defines default character code detection order. See also mb_detect_order().

mbstring.substitute_characterstring

Defines character to substitute for invalid character encoding. See mb_substitute_character() for supported values.

mbstring.func_overloadstring

Removed-8-0-0

Overloads a set of single byte functions by the mbstring counterparts. See Function overloading for more information.

This setting can only be changed from the Ini file.

mbstring.http_output_conv_mimetypesstring
mbstring.strict_detectionbool

Enables strict encoding detection. See mb_detect_encoding() for a description and examples.

mbstring.regex_retry_limitint

Limits the amount of backtracking that may be performed during one mbregex match.

This setting only takes effect when linking against oniguruma >= 6.8.0.

mbstring.regex_stack_limitint

Limits the stack depth of mbstring regular expressions.

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.

Ini setting examples

php
; Set default language
mbstring.language        = Neutral; Set default language to Neutral(UTF-8) (default)
mbstring.language        = English; Set default language to English 
mbstring.language        = Japanese; Set default language to Japanese

;; Set default internal encoding
;; Note: Make sure to use character encoding works with PHP
mbstring.internal_encoding    = UTF-8  ; Set internal encoding to UTF-8

;; HTTP input encoding translation is enabled.
mbstring.encoding_translation = On

;; Set default HTTP input character encoding
;; Note: Script cannot change http_input setting.
mbstring.http_input           = pass    ; No conversion. 
mbstring.http_input           = auto    ; Set HTTP input to auto
                                ; "auto" is expanded according to mbstring.language
mbstring.http_input           = SJIS    ; Set HTTP input to SJIS
mbstring.http_input           = UTF-8,SJIS,EUC-JP ; Specify order

;; Set default HTTP output character encoding 
mbstring.http_output          = pass    ; No conversion
mbstring.http_output          = UTF-8   ; Set HTTP output encoding to UTF-8

;; Set default character encoding detection order
mbstring.detect_order         = auto    ; Set detect order to auto
mbstring.detect_order         = ASCII,JIS,UTF-8,SJIS,EUC-JP ; Specify order

;; Set default substitute character
mbstring.substitute_character = 12307   ; Specify Unicode value
mbstring.substitute_character = none    ; Do not print character
mbstring.substitute_character = long    ; Long Example: U+3000,JIS+7E7E

Ini setting for EUC-JP users

php
;; Disable Output Buffering
output_buffering      = Off

;; Set HTTP header charset
default_charset       = EUC-JP    

;; Set default language to Japanese
mbstring.language = Japanese

;; HTTP input encoding translation is enabled.
mbstring.encoding_translation = On

;; Set HTTP input encoding conversion to auto
mbstring.http_input   = auto 

;; Convert HTTP output to EUC-JP
mbstring.http_output  = EUC-JP    

;; Set internal encoding to EUC-JP
mbstring.internal_encoding = EUC-JP    

;; Do not print invalid characters
mbstring.substitute_character = none   

Ini setting for SJIS users

php
;; Enable Output Buffering
output_buffering     = On

;; Set mb_output_handler to enable output conversion
output_handler       = mb_output_handler

;; Set HTTP header charset
default_charset      = Shift_JIS

;; Set default language to Japanese
mbstring.language = Japanese

;; Set http input encoding conversion to auto
mbstring.http_input  = auto 

;; Convert to SJIS
mbstring.http_output = SJIS    

;; Set internal encoding to EUC-JP
mbstring.internal_encoding = EUC-JP    

;; Do not print invalid characters
mbstring.substitute_character = none   

Source: reference/mbstring/ini.xml · from the official PHP manual (php/doc-en)