<!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>Converts a string with ISO-8859-1 characters encoded with UTF-8 to single-byte ISO-8859-1</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.xml.html">XML Parser Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.utf8-encode.html">utf8_encode</a></div> <div class="up"><a href="ref.xml.html">XML Parser Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.utf8-decode" class="refentry"> <div class="refnamediv"> <h1 class="refname">utf8_decode</h1> <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">utf8_decode</span> — <span class="dc-title"> Converts a string with ISO-8859-1 characters encoded with UTF-8 to single-byte ISO-8859-1 </span></p> </div> <div class="refsect1 description" id="refsect1-function.utf8-decode-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">string</span> <span class="methodname"><strong>utf8_decode</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span> )</div> <p class="para rdfs-comment"> This function converts the string <code class="parameter">data</code> from the <em>UTF-8</em> encoding to <em>ISO-8859-1</em>. Bytes in the string which are not valid <em>UTF-8</em>, and <em>UTF-8</em> characters which do not exist in <em>ISO-8859-1</em> (that is, characters above <em>U+00FF</em>) are replaced with <em>?</em>. </p> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> Many web pages marked as using the <em>ISO-8859-1</em> character encoding actually use the similar <em>Windows-1252</em> encoding, and web browsers will interpret <em>ISO-8859-1</em> web pages as <em>Windows-1252</em>. <em>Windows-1252</em> features additional printable characters, such as the Euro sign (<em>€</em>) and curly quotes (<em>“</em> <em>”</em>), instead of certain <em>ISO-8859-1</em> control characters. This function will not convert such <em>Windows-1252</em> characters correctly. Use a different function if <em>Windows-1252</em> conversion is required. </p> </p></blockquote> </div> <div class="refsect1 parameters" id="refsect1-function.utf8-decode-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <code class="parameter">data</code></dt> <dd> <p class="para"> A UTF-8 encoded string. </p> </dd> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.utf8-decode-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the ISO-8859-1 translation of <code class="parameter">data</code>. </p> </div> <div class="refsect1 changelog" id="refsect1-function.utf8-decode-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>7.2.0</td> <td> This function has been moved to the core of PHP, and therefore lifting the requirement on the XML extension for this function to be available. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 seealso" id="refsect1-function.utf8-decode-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><span class="function"><a href="function.utf8-encode.html" class="function" rel="rdfs-seeAlso">utf8_encode()</a> - Encodes an ISO-8859-1 string to UTF-8</span> - Performs the reverse conversion</li> <li class="member"><span class="function"><a href="function.mb-convert-encoding.html" class="function" rel="rdfs-seeAlso">mb_convert_encoding()</a> - Convert character encoding</span> - Converts between various character encodings, including UTF-8, ISO-8859-1 and Windows-1252</li> <li class="member"><span class="function"><a href="function.iconv.html" class="function" rel="rdfs-seeAlso">iconv()</a> - Convert string to requested character encoding</span> - Converts between various character encodings</li> <li class="member"><span class="function"><a href="function.recode-string.html" class="function" rel="rdfs-seeAlso">recode_string()</a> - Recode a string according to a recode request</span> - Converts between various character encodings</li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.xml.html">XML Parser Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.utf8-encode.html">utf8_encode</a></div> <div class="up"><a href="ref.xml.html">XML Parser Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>