Runtime Configuration
The behaviour of these functions is affected by settings in php.ini.
Name | Default | Changeable | Changelog |
---|---|---|---|
mbstring.language | "neutral" | PHP_INI_ALL | PHP_INI_PERDIR in PHP <= 5.2.6. |
mbstring.detect_order | NULL | PHP_INI_ALL | |
mbstring.http_input | "pass" | PHP_INI_ALL | Deprecated in PHP 5.6.0. |
mbstring.http_output | "pass" | PHP_INI_ALL | Deprecated in PHP 5.6.0. |
mbstring.internal_encoding | NULL | PHP_INI_ALL | Deprecated in PHP 5.6.0. |
mbstring.script_encoding | NULL | PHP_INI_ALL | Removed in PHP 5.4.0. Use zend.script_encoding instead. |
mbstring.substitute_character | NULL | PHP_INI_ALL | |
mbstring.func_overload | "0" | PHP_INI_SYSTEM | PHP_INI_PERDIR in PHP <= 5.2.6. Deprecated in PHP 7.2.0. |
mbstring.encoding_translation | "0" | PHP_INI_PERDIR | |
mbstring.http_output_conv_mimetypes | "^(text/|application/xhtml\+xml)" | PHP_INI_ALL | Available as of PHP 5.3.0. |
mbstring.strict_detection | "0" | PHP_INI_ALL | Available as of PHP 5.1.2. |
Here's a short explanation of the configuration directives.
-
mbstring.language
string -
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
boolean -
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
string -
Warning
This feature has been DEPRECATED as of PHP 5.6.0. Relying on this feature is highly discouraged.
Defines the default internal character encoding.
PHP 5.6 and later users should leave this empty and set
default_charset
instead. -
mbstring.http_input
string -
Warning
This feature has been DEPRECATED as of PHP 5.6.0. Relying on this feature is highly discouraged.
Defines the default HTTP input character encoding.
PHP 5.6 and later users should leave this empty and set
default_charset
instead. -
mbstring.http_output
string -
Warning
This feature has been DEPRECATED as of PHP 5.6.0. Relying on this feature is highly discouraged.
Defines the default HTTP output character encoding (output will be converted from the internal encoding to the HTTP output encoding upon output).
PHP 5.6 and later users should leave this empty and set
default_charset
instead. -
mbstring.detect_order
string -
Defines default character code detection order. See also mb_detect_order().
-
mbstring.substitute_character
string -
Defines character to substitute for invalid character encoding. See mb_substitute_character() for supported values.
-
mbstring.func_overload
string -
Warning
This feature has been DEPRECATED as of PHP 7.2.0. Relying on this feature is highly discouraged.
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 php.ini file.
-
mbstring.http_output_conv_mimetypes
string -
-
mbstring.strict_detection
boolean -
Enables the strict encoding detection.
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.
Example #1 php.ini setting examples
; 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
Example #2 php.ini setting for EUC-JP users
;; 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
Example #3 php.ini setting for SJIS users
;; 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
Vertaling niet beschikbaar
De PHP-handleiding is nog niet in het Nederlands vertaald, dus het scherm is in het Engels. Als u wilt, kunt u het ook in het Frans of in het Duits raadplegen.
Als je de moed voelt, kun je je vertaling aanbieden ;-)
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 30/01/2003 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/php-rf-mbstring.configuration.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.