<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.8 $ -->
<refentry xml:id="function.mb-output-handler" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>mb_output_handler</refname>
  <refpurpose>Callback function converts character encoding in output buffer</refpurpose> 
 </refnamediv>
   
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>string</type><methodname>mb_output_handler</methodname>
   <methodparam><type>string</type><parameter>contents</parameter></methodparam>
   <methodparam><type>int</type><parameter>status</parameter></methodparam>
  </methodsynopsis>
  <para>
   <function>mb_output_handler</function> is
   <function>ob_start</function> callback
   function. <function>mb_output_handler</function> converts
   characters in the output buffer from internal character encoding to
   HTTP output character encoding. 
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>contents</parameter></term>
     <listitem>
      <para>
       The contents of the output buffer.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>status</parameter></term>
     <listitem>
      <para>
       The status of the output buffer.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>
 
 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   The converted <type>string</type>.
  </para>
 </refsect1>

 <refsect1 role="changelog">
  &reftitle.changelog;
  <para>
   <informaltable>
    <tgroup cols="2">
     <thead>
      <row>
       <entry>&Version;</entry>
       <entry>&Description;</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry>4.1.0</entry>
       <entry>
        <para>
         This handler now adds the charset HTTP header when the following conditions are met:
        </para>
        <para>
         <itemizedlist>
          <listitem>
           <simpara>
            Does not set <literal>Content-Type</literal>, using <function>header</function>.
           </simpara>
          </listitem>
          <listitem>
           <simpara>
            The default MIME type begins with <literal>text/</literal>.
           </simpara>
          </listitem>
          <listitem>
           <simpara>
            The <link linkend="ini.mbstring.http-input">mbstring.http_input</link> 
            setting is something other than <literal>pass</literal>.
           </simpara>
          </listitem>
         </itemizedlist>
        </para>
       </entry>
      </row>
     </tbody>
    </tgroup>
   </informaltable>
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title><function>mb_output_handler</function> example</title>
    <programlisting role="php">
<![CDATA[
<?php
mb_http_output("UTF-8");
ob_start("mb_output_handler");
?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>

 <refsect1 role="notes">
  &reftitle.notes;
  <note>
   <para>
    If you want to output some binary data such as image from PHP
    script with PHP 4.3.0 or later, Content-Type: header must be send
    using <function>header</function> before any binary data was send
    to client (e.g. header("Content-Type: image/png")).
    If Content-Type: header was send, output character encoding
    conversion will not be performed.
   </para>
   <para>
    Note that if 'Content-Type: text/*' was send using
    <function>header</function>, the sending data is regarded as text,
    encoding conversion will be performed using character encoding
    settings.
   </para>
   <para>
    If you want to output some binary data such as image from PHP
    script with PHP 4.2.x or earlier, you must set output encoding to
    &quot;pass&quot; using <function>mb_http_output</function>.
   </para>
  </note>
 </refsect1>
 
 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>ob_start</function></member>
   </simplelist>
  </para>
 </refsect1>

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->