php-doc-en/reference/mbstring/functions/mb-output-handler.xml
Jakub Vrana f8bd23e2bb Xmas typos 4/5
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@146741 c90b9560-bf6c-de11-be94-00142212c4b1
2003-12-18 14:14:41 +00:00

113 lines
3.4 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- 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 handler 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[
<?php
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
-->