<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Decodes a MIME header field</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.iconv-mime-decode-headers.html">iconv_mime_decode_headers</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.iconv-mime-encode.html">iconv_mime_encode</a></div> <div class="up"><a href="ref.iconv.html">iconv Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.iconv-mime-decode" class="refentry"> <div class="refnamediv"> <h1 class="refname">iconv_mime_decode</h1> <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">iconv_mime_decode</span> — <span class="dc-title">Decodes a <em>MIME</em> header field</span></p> </div> <div class="refsect1 description" id="refsect1-function.iconv-mime-decode-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">string</span> <span class="methodname"><strong>iconv_mime_decode</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$encoded_header</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code><span class="initializer"> = 0</span></span> [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$charset</code><span class="initializer"> = ini_get("iconv.internal_encoding")</span></span> ]] )</div> <p class="para rdfs-comment"> Decodes a <em>MIME</em> header field. </p> </div> <div class="refsect1 parameters" id="refsect1-function.iconv-mime-decode-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">encoded_header</code></em></span> <dd> <p class="para"> The encoded header, as a string. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">mode</code></em></span> <dd> <p class="para"> <em><code class="parameter">mode</code></em> determines the behaviour in the event <span class="function"><strong>iconv_mime_decode()</strong></span> encounters a malformed <em>MIME</em> header field. You can specify any combination of the following bitmasks. <table class="doctable table"> <caption><strong>Bitmasks acceptable to <span class="function"><strong>iconv_mime_decode()</strong></span></strong></caption> <thead> <tr> <th>Value</th> <th>Constant</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>1</td> <td>ICONV_MIME_DECODE_STRICT</td> <td> If set, the given header is decoded in full conformance with the standards defined in <a href="http://www.faqs.org/rfcs/rfc2047" class="link external">» RFC2047</a>. This option is disabled by default because there are a lot of broken mail user agents that don't follow the specification and don't produce correct <em>MIME</em> headers. </td> </tr> <tr> <td>2</td> <td>ICONV_MIME_DECODE_CONTINUE_ON_ERROR</td> <td> If set, <span class="function"><a href="function.iconv-mime-decode-headers.html" class="function">iconv_mime_decode_headers()</a></span> attempts to ignore any grammatical errors and continue to process a given header. </td> </tr> </tbody> </table> </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">charset</code></em></span> <dd> <p class="para"> The optional <em><code class="parameter">charset</code></em> parameter specifies the character set to represent the result by. If omitted, <a href="iconv.configuration.html" class="link">iconv.internal_encoding</a> will be used. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.iconv-mime-decode-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns a decoded <em>MIME</em> field on success, or <strong><code>FALSE</code></strong> if an error occurs during the decoding. </p> </div> <div class="refsect1 examples" id="refsect1-function.iconv-mime-decode-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-2477"> <p><strong>Example #1 <span class="function"><strong>iconv_mime_decode()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// This yields "Subject: Prüfung Prüfung"<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">iconv_mime_decode</span><span style="color: #007700">(</span><span style="color: #DD0000">"Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?="</span><span style="color: #007700">,<br /> </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #DD0000">"ISO-8859-1"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-function.iconv-mime-decode-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.iconv-mime-decode-headers.html" class="function" rel="rdfs-seeAlso">iconv_mime_decode_headers()</a> - Decodes multiple MIME header fields at once</span></li> <li class="member"> <span class="function"><a href="function.mb-decode-mimeheader.html" class="function" rel="rdfs-seeAlso">mb_decode_mimeheader()</a> - Decode string in MIME header field</span></li> <li class="member"> <span class="function"><a href="function.imap-mime-header-decode.html" class="function" rel="rdfs-seeAlso">imap_mime_header_decode()</a> - Decode MIME header elements</span></li> <li class="member"> <span class="function"><a href="function.imap-base64.html" class="function" rel="rdfs-seeAlso">imap_base64()</a> - Decode BASE64 encoded text</span></li> <li class="member"> <span class="function"><a href="function.imap-qprint.html" class="function" rel="rdfs-seeAlso">imap_qprint()</a> - Convert a quoted-printable string to an 8 bit string</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.iconv-mime-decode-headers.html">iconv_mime_decode_headers</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.iconv-mime-encode.html">iconv_mime_encode</a></div> <div class="up"><a href="ref.iconv.html">iconv Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>