Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 6497

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!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>Encodes an ISO-8859-1 string to UTF-8</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.utf8-decode.html">utf8_decode</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.xml-error-string.html">xml_error_string</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-encode" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">utf8_encode</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">utf8_encode</span> &mdash; <span class="dc-title">Encodes an ISO-8859-1 string to UTF-8</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.utf8-encode-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>utf8_encode</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
   )</div>

  <p class="para rdfs-comment">
   This function encodes the string <em><code class="parameter">data</code></em> to
   <em>UTF-8</em>, and returns the encoded version.
   <em>UTF-8</em> is a standard mechanism used by
   <acronym title="Unique, Universal, and Uniform character enCoding">Unicode</acronym> for encoding <span class="glossterm">wide
   character</span> values into a byte stream.
   <em>UTF-8</em> is transparent to plain <abbr class="abbrev">ASCII</abbr>
   characters, is self-synchronized (meaning it is possible for a program to
   figure out where in the bytestream characters start) and can be used with
   normal string comparison functions for sorting and such. PHP encodes
   <em>UTF-8</em> characters in up to four bytes, like this:
   <table class="doctable table">
    <caption><strong>UTF-8 encoding</strong></caption>
    
     <thead>
      <tr>
       <th>bytes</th>
       <th>bits</th>
       <th>representation</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>1</td>
       <td>7</td>
       <td>0bbbbbbb</td>
      </tr>

      <tr>
       <td>2</td>
       <td>11</td>
       <td>110bbbbb 10bbbbbb</td>
      </tr>

      <tr>
       <td>3</td>
       <td>16</td>
       <td>1110bbbb 10bbbbbb 10bbbbbb</td>
      </tr>

      <tr>
       <td>4</td>
       <td>21</td>
       <td>11110bbb 10bbbbbb 10bbbbbb 10bbbbbb</td>
      </tr>

     </tbody>
    
   </table>

   Each <span class="replaceable">b</span> represents a bit that can be
   used to store character data.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.utf8-encode-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">data</code></em></span>
     <dd>

      <p class="para">
       An ISO-8859-1 string.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.utf8-encode-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns the UTF-8 translation of <em><code class="parameter">data</code></em>.
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.utf8-decode.html">utf8_decode</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.xml-error-string.html">xml_error_string</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>