<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Runtime Configuration</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mbstring.installation.html">Installation</a></div> <div class="next" style="text-align: right; float: right;"><a href="mbstring.resources.html">Resource Types</a></div> <div class="up"><a href="mbstring.setup.html">Installing/Configuring</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="mbstring.configuration" class="section"> <h2 class="title">Runtime Configuration</h2> <p class="simpara"> The behaviour of these functions is affected by settings in <var class="filename">php.ini</var>. </p> <p class="para"> <table class="doctable table"> <caption><strong>mbstring configuration options</strong></caption> <thead> <tr> <th>Name</th> <th>Default</th> <th>Changeable</th> <th>Changelog</th> </tr> </thead> <tbody class="tbody"> <tr> <td><a href="mbstring.configuration.html#ini.mbstring.language" class="link">mbstring.language</a></td> <td>"neutral"</td> <td>PHP_INI_ALL</td> <td> Available since PHP 4.3.0. PHP_INI_PERDIR in PHP <= 5.2.6 </td> </tr> <tr> <td><a href="mbstring.configuration.html#ini.mbstring.detect-order" class="link">mbstring.detect_order</a></td> <td>NULL</td> <td>PHP_INI_ALL</td> <td>Available since PHP 4.0.6.</td> </tr> <tr> <td><a href="mbstring.configuration.html#ini.mbstring.http-input" class="link">mbstring.http_input</a></td> <td>"pass"</td> <td>PHP_INI_ALL</td> <td>Available since PHP 4.0.6.</td> </tr> <tr> <td><a href="mbstring.configuration.html#ini.mbstring.http-output" class="link">mbstring.http_output</a></td> <td>"pass"</td> <td>PHP_INI_ALL</td> <td>Available since PHP 4.0.6.</td> </tr> <tr> <td><a href="mbstring.configuration.html#ini.mbstring.internal-encoding" class="link">mbstring.internal_encoding</a></td> <td>NULL</td> <td>PHP_INI_ALL</td> <td>Available since PHP 4.0.6.</td> </tr> <tr> <td>mbstring.script_encoding</td> <td>NULL</td> <td>PHP_INI_ALL</td> <td>Available since PHP 4.3.0.</td> </tr> <tr> <td><a href="mbstring.configuration.html#ini.mbstring.substitute-character" class="link">mbstring.substitute_character</a></td> <td>NULL</td> <td>PHP_INI_ALL</td> <td>Available since PHP 4.0.6.</td> </tr> <tr> <td><a href="mbstring.configuration.html#ini.mbstring.func-overload" class="link">mbstring.func_overload</a></td> <td>"0"</td> <td>PHP_INI_SYSTEM</td> <td> PHP_INI_PERDIR from PHP 4.3 to 5.2.6, otherwise PHP_INI_SYSTEM. Available since PHP 4.2.0. </td> </tr> <tr> <td><a href="mbstring.configuration.html#ini.mbstring.encoding-translation" class="link">mbstring.encoding_translation</a></td> <td>"0"</td> <td>PHP_INI_PERDIR</td> <td>Available since PHP 4.3.0.</td> </tr> <tr> <td><a href="mbstring.configuration.html#ini.mbstring.strict-detection" class="link">mbstring.strict_detection</a></td> <td>"0"</td> <td>PHP_INI_ALL</td> <td>Available since PHP 5.1.2.</td> </tr> </tbody> </table> For further details and definitions of the PHP_INI_* modes, see the <a href="configuration.changes.modes.html" class="xref">Where a configuration setting may be set</a>. </p> <p class="para">Here's a short explanation of the configuration directives.</p> <p class="para"> <dl> <dt id="ini.mbstring.language"> <span class="term"> <em><code class="parameter">mbstring.language</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> The default national language setting (NLS) used in mbstring. Note that this option automagically defines <em>mbstring.internal_encoding</em> and <em>mbstring.internal_encoding</em> should be placed after <em>mbstring.language</em> in <var class="filename">php.ini</var> </p> </dd> </dt> <dt id="ini.mbstring.encoding-translation"> <span class="term"> <em><code class="parameter">mbstring.encoding_translation</code></em> <span class="type"><a href="language.types.boolean.html" class="type boolean">boolean</a></span> </span> <dd> <p class="para"> 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. </p> </dd> </dt> <dt id="ini.mbstring.internal-encoding"> <span class="term"> <em><code class="parameter">mbstring.internal_encoding</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> Defines the default internal character encoding. </p> </dd> </dt> <dt id="ini.mbstring.http-input"> <span class="term"> <em><code class="parameter">mbstring.http_input</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> Defines the default HTTP input character encoding. </p> </dd> </dt> <dt id="ini.mbstring.http-output"> <span class="term"> <em><code class="parameter">mbstring.http_output</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> Defines the default HTTP output character encoding. </p> </dd> </dt> <dt id="ini.mbstring.detect-order"> <span class="term"> <em><code class="parameter">mbstring.detect_order</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> Defines default character code detection order. See also <span class="function"><a href="function.mb-detect-order.html" class="function">mb_detect_order()</a></span>. </p> </dd> </dt> <dt id="ini.mbstring.substitute-character"> <span class="term"> <em><code class="parameter">mbstring.substitute_character</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> Defines character to substitute for invalid character encoding. </p> </dd> </dt> <dt id="ini.mbstring.func-overload"> <span class="term"> <em><code class="parameter">mbstring.func_overload</code></em> <span class="type"><a href="language.types.string.html" class="type string">string</a></span> </span> <dd> <p class="para"> Overloads a set of single byte functions by the mbstring counterparts. See <a href="mbstring.overload.html" class="link">Function overloading</a> for more information. </p> <p class="para"> This setting can only be changed from the <var class="filename">php.ini</var> file. </p> </dd> </dt> <dt id="ini.mbstring.strict-detection"> <span class="term"> <em><code class="parameter">mbstring.strict_detection</code></em> <span class="type"><a href="language.types.boolean.html" class="type boolean">boolean</a></span> </span> <dd> <p class="para"> Enables the strict encoding detection. </p> </dd> </dt> </dl> </p> <p class="para"> According to the <a href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accept-charset" class="link external">» HTML 4.01 specification</a>, Web browsers are allowed to encode a form being submitted with a character encoding different from the one used for the page. See <span class="function"><a href="function.mb-http-input.html" class="function">mb_http_input()</a></span> to detect character encoding used by browsers. </p> <p class="para"> 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 <em>charset</em> parameter in the <em>Content-Type</em> HTTP header to the appropriate value by <span class="function"><a href="function.header.html" class="function">header()</a></span> or <a href="ini.core.html#ini.sect.data-handling" class="link">default_charset</a> ini setting. </p> <p class="para"> <div class="example" id="example-2693"> <p><strong>Example #1 <var class="filename">php.ini</var> setting examples</strong></p> <div class="example-contents"> <div class="cdata"><pre> ; 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 </pre></div> </div> </div> </p> <p class="para"> <div class="example" id="example-2694"> <p><strong>Example #2 <var class="filename">php.ini</var> setting for <em>EUC-JP</em> users</strong></p> <div class="example-contents"> <div class="cdata"><pre> ;; 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 </pre></div> </div> </div> </p> <p class="para"> <div class="example" id="example-2695"> <p><strong>Example #3 <var class="filename">php.ini</var> setting for <em>SJIS</em> users</strong></p> <div class="example-contents"> <div class="cdata"><pre> ;; 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 </pre></div> </div> </div> </p> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mbstring.installation.html">Installation</a></div> <div class="next" style="text-align: right; float: right;"><a href="mbstring.resources.html">Resource Types</a></div> <div class="up"><a href="mbstring.setup.html">Installing/Configuring</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>