<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/mbstring.xml, last change in rev 1.1 -->
  <refentry id="function.mb-output-handler">
   <refnamediv>
    <refname>mb_output_handler</refname>
    <refpurpose>
     Callback function converts character encoding in output buffer
    </refpurpose> 
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <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 output buffer from internal character encoding to
     HTTP output character encoding. 
     </para>
    <para>
     4.1.0 or later version, this hanlder adds charset HTTP header
     when following conditions are met:
    </para>
    <para>
     <itemizedlist>
      <listitem>
       <simpara>Does not set <literal>Content-Type</literal> by
       header()</simpara>
      </listitem>
      <listitem>
       <simpara>Default MIME type begins with
       <literal>text/</literal></simpara>
      </listitem>
      <listitem>
       <simpara><literal>http_output</literal> setting is other than
       pass</simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     <parameter>contents</parameter> : Output buffer contents
    </para>
    <para>
     <parameter>status</parameter> : Output buffer status
    </para>
    <para>
     Return Value: String converted
    </para>
    <para>
     <example>
      <title><function>mb_output_handler</function> example</title>
      <programlisting role="php">
<![CDATA[
mb_http_output("UTF-8");
ob_start("mb_output_handler");
]]>
      </programlisting>
     </example>
    </para>
    <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>
    <para>
     See also <function>ob_start</function>.
    </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
-->