File: iconv-mime-encode.xml

package info (click to toggle)
php-doc 20081024-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 57,752 kB
  • ctags: 3,858
  • sloc: xml: 686,554; php: 19,446; perl: 610; cpp: 500; makefile: 336; sh: 114; awk: 28
file content (220 lines) | stat: -rw-r--r-- 7,315 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.15 $ -->
<refentry xml:id="function.iconv-mime-encode" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>iconv_mime_encode</refname>
  <refpurpose>Composes a <literal>MIME</literal> header field</refpurpose>
 </refnamediv>
 
 <refsect1 role="description">
  &reftitle.description;
  <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>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>field_name</parameter></term>
     <listitem>
      <para>
       The field name.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>field_value</parameter></term>
     <listitem>
      <para>
       The field value.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>preferences</parameter></term>
     <listitem>
      <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>string</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_encoding</link>
            ini setting.
           </entry>
           <entry>
            <link linkend="iconv.configuration">iconv.internal_encoding</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>
            <link linkend="iconv.configuration">iconv.internal_encoding</link>
           </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
            <link xlink:href="&url.rfc;2822">RFC2822 - Internet Message Format</link>.
            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>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   Returns an encoded <literal>MIME</literal> field on success,
   or &false; if an error occurs during the encoding.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title><function>iconv_mime_encode</function> example</title>
    <programlisting role="php">
<![CDATA[
<?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", "Prfung Prfung", $preferences);

$preferences["scheme"] = "B";
// This yields "Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?="
echo iconv_mime_encode("Subject", "Prfung Prfung", $preferences);
?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>imap_binary</function></member>
    <member><function>mb_encode_mimeheader</function></member>
    <member><function>imap_8bit</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
-->