<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.mbstring.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'mbstring.http.php',
    1 => 'HTTP Input and Output',
    2 => 'HTTP Input and Output',
  ),
  'up' => 
  array (
    0 => 'book.mbstring.php',
    1 => 'Multibyte String',
  ),
  'prev' => 
  array (
    0 => 'mbstring.ja-basic.php',
    1 => 'Basics of Japanese multi-byte encodings',
  ),
  'next' => 
  array (
    0 => 'mbstring.supported-encodings.php',
    1 => 'Supported Character Encodings',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mbstring/http-inout.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mbstring.http" class="chapter">
 <h1 class="title">HTTP Input and Output</h1>

 <p class="para">
  HTTP input/output character encoding conversion may convert
  binary data also. Users are supposed to control character
  encoding conversion if binary data is used for HTTP
  input/output.
 </p>
 <blockquote class="note"><p><strong class="note">Nota</strong>: 
  <p class="para">
   If <code class="literal">enctype</code> for HTML form is
   set to <code class="literal">multipart/form-data</code> and
   <code class="literal">mbstring.encoding_translation</code> is set to On
   in <var class="filename">php.ini</var> the POST&#039;ed variables and the names of uploaded files
   will be converted to the internal character encoding as well.
   However, the conversion isn&#039;t applied to the query keys.
  </p>
 </p></blockquote>
 <p class="para">
  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara">
     HTTP Input
    </span>
    <p class="para"> 
     There is no way to control HTTP input character
     conversion from a PHP script. To disable HTTP input character
     conversion, it has to be done in <var class="filename">php.ini</var>.
     <div class="example" id="example-1">
      <p><strong>Example #1 
       Disable HTTP input conversion in <var class="filename">php.ini</var>
      </strong></p>
      <div class="example-contents">
<div class="annotation-interactive php.inicode"><pre class="php.inicode">;; Disable HTTP Input conversion
mbstring.http_input = pass
;; Disable HTTP Input conversion
mbstring.encoding_translation = Off</pre>
</div>
      </div>

     </div>
    </p>
    <p class="para">
     When using PHP as an Apache module, it is possible to
     override those settings in each Virtual Host directive in
     <var class="filename">httpd.conf</var> or per directory with <var class="filename">.htaccess</var>. Refer to the <a href="configuration.php" class="link">Configuration</a> section and
     Apache Manual for details.
    </p>
   </li>
   <li class="listitem">
    <span class="simpara">
     HTTP Output
    </span>
    <p class="para">
     There are several ways to enable output character encoding
     conversion. One is using <var class="filename">php.ini</var>, another
     is using <span class="function"><a href="function.ob-start.php" class="function">ob_start()</a></span> with
     <span class="function"><a href="function.mb-output-handler.php" class="function">mb_output_handler()</a></span> as the 
     <code class="literal">ob_start</code> callback function.
    </p>
   </li>
  </ul>
 </p>
 <p class="para">
  <div class="example" id="example-2">
   <p><strong>Example #2 <var class="filename">php.ini</var> setting example</strong></p>
   <div class="example-contents">
<div class="annotation-interactive cdata"><pre>
;; Enable output character encoding conversion for all PHP pages

;; Enable Output Buffering
output_buffering    = On

;; Set mb_output_handler to enable output conversion
output_handler      = mb_output_handler
</pre></div>
   </div>

  </div>
 </p>
 <p class="para">
  <div class="example" id="example-3">
   <p><strong>Example #3 Script example</strong></p>
   <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">// Enable output character encoding conversion only for this page<br /><br />// Set HTTP output character encoding to SJIS<br /></span><span style="color: #0000BB">mb_http_output</span><span style="color: #007700">(</span><span style="color: #DD0000">'SJIS'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Start buffering and specify "mb_output_handler" as<br />// callback function<br /></span><span style="color: #0000BB">ob_start</span><span style="color: #007700">(</span><span style="color: #DD0000">'mb_output_handler'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

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