php-doc-en/reference/iconv/functions/iconv-mime-encode.xml
Jakub Vrana 7c3c733280 Nuke tabs
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@165202 c90b9560-bf6c-de11-be94-00142212c4b1
2004-08-04 07:25:31 +00:00

172 lines
6 KiB
XML

<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.8 $ -->
<!-- Generated by xml_proto.php v2.0. Found in /scripts directory of phpdoc. -->
<refentry id="function.iconv-mime-encode">
<refnamediv>
<refname>iconv_mime_encode</refname>
<refpurpose>
Composes a <literal>MIME</literal> header field
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>iconv_mime_encode</methodname>
<methodparam><type>string</type><parameter>field_name</parameter></methodparam>
<methodparam><type>string</type><parameter>field_value</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>preferences</parameter></methodparam>
</methodsynopsis>
<para>
Composes and returns a string that represents a valid <literal>MIME</literal>
header field, which looks like the following:
<screen>
<![CDATA[
Subject: =?ISO-8859-1?Q?Pr=FCfung_f=FCr?= Entwerfen von einer MIME kopfzeile
]]>
</screen>
In the above example, "Subject" is the field name and the portion that
begins with "=?ISO-8859-1?..." is the field value.
</para>
<para>
You can control the behaviour of <function>iconv_mime_encode</function>
by specifying an associative array that contains configuration items
to the optional third parameter <parameter>preferences</parameter>.
The items supported by <function>iconv_mime_encode</function> are
listed below. Note that item names are treated case-sensitive.
<table>
<title>Configuration items supported by <function>iconv_mime_encode</function></title>
<tgroup cols="5">
<thead>
<row>
<entry>Item</entry>
<entry>Type</entry>
<entry>Description</entry>
<entry>Default value</entry>
<entry>Example</entry>
</row>
</thead>
<tbody>
<row>
<entry>scheme</entry>
<entry><type>boolean</type></entry>
<entry>
Specifies the method to encode a field value by. The value of
this item may be either "B" or "Q", where "B" stands for
<literal>base64</literal> encoding scheme and "Q" stands for
<literal>quoted-printable</literal> encoding scheme.
</entry>
<entry>B</entry>
<entry>B</entry>
</row>
<row>
<entry>input-charset</entry>
<entry><type>string</type></entry>
<entry>
Specifies the character set in which the first parameter
<parameter>field_name</parameter> and the second parameter
<parameter>field_value</parameter> are presented. If not given,
<function>iconv_mime_encode</function> assumes those parameters
are presented to it in the
<link linkend="iconv.configuration">iconv.internal_charset</link>
ini setting.
</entry>
<entry>
<link linkend="iconv.configuration">iconv.internal_charset</link>
</entry>
<entry>ISO-8859-1</entry>
</row>
<row>
<entry>output-charset</entry>
<entry><type>string</type></entry>
<entry>
Specifies the character set to use to compose the
<literal>MIME</literal> header. If not given, the same value as
<literal>input-charset</literal> will be used.
</entry>
<entry>
the same value as <literal>input-charset</literal>
</entry>
<entry>UTF-8</entry>
</row>
<row>
<entry>line-length</entry>
<entry><type>integer</type></entry>
<entry>
Specifies the maximum length of the header lines. The resulting
header is "folded" to a set of multiple lines in case
the resulting header field would be longer than the value of this
parameter, according to
<ulink url="&url.rfc;2822">RFC2822 - Internet Message Format</ulink>.
If not given, the length will be limited to 76 characters.
</entry>
<entry>76</entry>
<entry>996</entry>
</row>
<row>
<entry>line-break-chars</entry>
<entry><type>string</type></entry>
<entry>
Specifies the sequence of characters to append to each line
as an end-of-line sign when "folding" is performed on a long header
field. If not given, this defaults to "\r\n"
(<literal>CR</literal> <literal>LF</literal>). Note that
this parameter is always treated as an ASCII string regardless
of the value of <literal>input-charset</literal>.
</entry>
<entry>\r\n</entry>
<entry>\n</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<example>
<title><function>iconv_mime_encode</function> example:</title>
<programlisting role="php">
&lt;?php
$preferences = array(
"input-charset" => "ISO-8859-1",
"output-charset" => "UTF-8",
"line-length" => 76,
"line-break-chars" => "\n"
);
$preferences["scheme"] = "Q";
// This yields "Subject: =?UTF-8?Q?Pr=C3=BCfung_Pr=C3=BCfung?="
echo iconv_mime_encode("Subject", "Pr&uuml;fung Pr&uuml;fung", $preferences);
$preferences["scheme"] = "B";
// This yields "Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?="
echo iconv_mime_encode("Subject", "Pr&uuml;fung Pr&uuml;fung", $preferences);
?&gt;
</programlisting>
</example>
<para>
See also <function>imap_binary</function>,
<function>mb_encode_mimeheader</function>
and <function>imap_8bit</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
-->