<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.mbstring.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.mb-internal-encoding.php',
    1 => 'mb_internal_encoding',
    2 => 'Set/Get internal character encoding',
  ),
  'up' => 
  array (
    0 => 'ref.mbstring.php',
    1 => 'Multibyte String Functions',
  ),
  'prev' => 
  array (
    0 => 'function.mb-http-output.php',
    1 => 'mb_http_output',
  ),
  'next' => 
  array (
    0 => 'function.mb-language.php',
    1 => 'mb_language',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mbstring/functions/mb-internal-encoding.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.mb-internal-encoding" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mb_internal_encoding</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">mb_internal_encoding</span> &mdash; <span class="dc-title">Set/Get internal character encoding</span></p>

 </div>
   
 <div class="refsect1 description" id="refsect1-function.mb-internal-encoding-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mb_internal_encoding</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$encoding</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></span></div>

  <p class="para rdfs-comment">
   Set/Get the internal character encoding
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mb-internal-encoding-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">encoding</code></dt>
     <dd>
      <p class="para">
       <code class="parameter">encoding</code> is the character encoding name 
       used for the HTTP input character encoding conversion, HTTP output 
       character encoding conversion, and the default character encoding 
       for string functions defined by the mbstring module.
       You should notice that the internal encoding is totally different from the one for multibyte regex.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.mb-internal-encoding-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   If <code class="parameter">encoding</code> is set, then 
   Returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> on success or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure.
   In this case, the character encoding for multibyte regex is NOT changed.
   If <code class="parameter">encoding</code> is omitted, then 
   the current character encoding name is returned.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.mb-internal-encoding-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">
   As of PHP 8.0.0, a <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span> is thrown if the
   value of <code class="parameter">encoding</code> is an invalid encoding.
   Prior to PHP 8.0.0, a <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> was emitted instead.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.mb-internal-encoding-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.0.0</td>
 <td>
  <code class="parameter">encoding</code> is nullable now.
 </td>
</tr>

     <tr>
      <td>8.0.0</td>
      <td>
       Now throws a <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span> if
       <code class="parameter">encoding</code> is an invalid encoding.
       Previously a <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> was emitted instead.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.mb-internal-encoding-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 <span class="function"><strong>mb_internal_encoding()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/* Set internal character encoding to UTF-8 */<br /></span><span style="color: #0000BB">mb_internal_encoding</span><span style="color: #007700">(</span><span style="color: #DD0000">"UTF-8"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* Display current internal character encoding */<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">mb_internal_encoding</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 

 <div class="refsect1 seealso" id="refsect1-function.mb-internal-encoding-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.mb-http-input.php" class="function" rel="rdfs-seeAlso">mb_http_input()</a> - Detect HTTP input character encoding</span></li>
    <li><span class="function"><a href="function.mb-http-output.php" class="function" rel="rdfs-seeAlso">mb_http_output()</a> - Set/Get HTTP output character encoding</span></li>
    <li><span class="function"><a href="function.mb-detect-order.php" class="function" rel="rdfs-seeAlso">mb_detect_order()</a> - Set/Get character encoding detection order</span></li>
    <li><span class="function"><a href="function.mb-regex-encoding.php" class="function" rel="rdfs-seeAlso">mb_regex_encoding()</a> - Set/Get character encoding for multibyte regex</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>