php-doc-en/reference/mbstring/functions/mb-output-handler.xml
Joe Watkins e25450d9dc many bugs
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@328365 c90b9560-bf6c-de11-be94-00142212c4b1
2012-11-15 13:40:31 +00:00

168 lines
4.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<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>
<literal>Content-Type</literal> has not been set, 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 binary data, such as an image, using PHP 4.3.0 or later,
a Content-Type: header must be set using <function>header</function>
before any binary data is sent to the client (e.g. header("Content-Type: image/png")).
If Content-Type: header is sent, output character encoding conversion will not be performed.
</para>
<para>
Note that if 'Content-Type: text/*' is sent, the content body is regarded as text; conversion will take place.
</para>
<para>
If you want to output binary data, such as an image, using 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:"~/.phpdoc/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
-->