<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.iconv.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.iconv.php',
    1 => 'iconv',
    2 => 'Convertit une cha&icirc;ne de caract&egrave;res &agrave; partir d\'un encodage vers un autre',
  ),
  'up' => 
  array (
    0 => 'ref.iconv.php',
    1 => 'Fonctions iconv',
  ),
  'prev' => 
  array (
    0 => 'ref.iconv.php',
    1 => 'Fonctions iconv',
  ),
  'next' => 
  array (
    0 => 'function.iconv-get-encoding.php',
    1 => 'iconv_get_encoding',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/iconv/functions/iconv.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.iconv" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">iconv</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.5, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">iconv</span> &mdash; <span class="dc-title">Convertit une chaîne de caractères à partir d&#039;un encodage vers un autre</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.iconv-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>iconv</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$from_encoding</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$to_encoding</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$string</code></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Convertit la chaîne <code class="parameter">string</code> à partir de <code class="parameter">from_encoding</code>
   vers l&#039;encodage <code class="parameter">to_encoding</code>.
  </p>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-function.iconv-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">from_encoding</code></dt>
     <dd>
      <p class="para">
       L&#039;encodage utilisé pour interpréter <code class="parameter">string</code>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">to_encoding</code></dt>
     <dd>
      <p class="para">
       L&#039;encodage souhaité du résultat.
      </p>
      <p class="para">
       Si la chaîne <code class="literal">//TRANSLIT</code> est ajoutée au paramètre
       <code class="parameter">to_encoding</code>, alors la translittération est activée.
       Cela signifie que lorsqu&#039;un caractère ne peut être représenté dans le jeu
       de caractères cible, il pourrait être représenté approximativement à partir
       d&#039;un ou plusieurs caractères représentant le même caractère.
       Si la chaîne <code class="literal">//IGNORE</code> est ajoutée, les caractères
       ne pouvant être représentés dans le jeu de caractères cible seront
       tout simplement ignorés. Sinon, une alerte de niveau
       <strong><code><a href="errorfunc.constants.php#constant.e-notice">E_NOTICE</a></code></strong> sera générée et la fonction retournera
       <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
      </p>
      <div class="caution"><strong class="caution">Attention</strong>
       <p class="para">
        Si et comment <code class="literal">//TRANSLIT</code> fonctionne exactement dépend
        de l&#039;implémentation iconv() du système (cf. <strong><code><a href="iconv.constants.php#constant.iconv-impl">ICONV_IMPL</a></code></strong>).
        Certaines implémentations sont connues pour ignorer <code class="literal">//TRANSLIT</code>,
        donc la conversion de caractères illégaux échouera probablement pour
        <code class="parameter">to_encoding</code>.
       </p>
      </div>
     </dd>
    
    
     <dt><code class="parameter">string</code></dt>
     <dd>
      <p class="para">
       La <a href="language.types.string.php" class="link">chaîne de caractères</a> à convertir.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.iconv-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Retourne la <a href="language.types.string.php" class="link">chaîne de caractères</a> convertie,  ou <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> si une erreur survient.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.iconv-examples">
  <h3 class="title">Exemples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Exemple avec <span class="function"><strong>iconv()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$text </span><span style="color: #007700">= </span><span style="color: #DD0000">"Ceci est le symbole de l'Euro '€'."</span><span style="color: #007700">;<br /><br />echo </span><span style="color: #DD0000">'Original : '</span><span style="color: #007700">, </span><span style="color: #0000BB">$text</span><span style="color: #007700">, </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />echo </span><span style="color: #DD0000">'TRANSLIT : '</span><span style="color: #007700">, </span><span style="color: #0000BB">iconv</span><span style="color: #007700">(</span><span style="color: #DD0000">"UTF-8"</span><span style="color: #007700">, </span><span style="color: #DD0000">"ISO-8859-1//TRANSLIT"</span><span style="color: #007700">, </span><span style="color: #0000BB">$text</span><span style="color: #007700">), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />echo </span><span style="color: #DD0000">'IGNORE   : '</span><span style="color: #007700">, </span><span style="color: #0000BB">iconv</span><span style="color: #007700">(</span><span style="color: #DD0000">"UTF-8"</span><span style="color: #007700">, </span><span style="color: #DD0000">"ISO-8859-1//IGNORE"</span><span style="color: #007700">, </span><span style="color: #0000BB">$text</span><span style="color: #007700">), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />echo </span><span style="color: #DD0000">'Brut     : '</span><span style="color: #007700">, </span><span style="color: #0000BB">iconv</span><span style="color: #007700">(</span><span style="color: #DD0000">"UTF-8"</span><span style="color: #007700">, </span><span style="color: #DD0000">"ISO-8859-1"</span><span style="color: #007700">, </span><span style="color: #0000BB">$text</span><span style="color: #007700">), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Résultat de l&#039;exemple ci-dessus est similaire à :</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Original : Ceci est le symbole de l&#039;Euro &#039;€&#039;.
TRANSLIT : Ceci est le symbole de l&#039;Euro &#039;EUR&#039;.
IGNORE   : Ceci est le symbole de l&#039;Euro &#039;&#039;.
Brut     : Ceci est le symbole de l&#039;Euro &#039;
Notice: iconv(): Detected an illegal character in input string in /Users/macbook/Desktop/- on line 8
Ceci est le symbole de l&#039;Euro &#039;</pre>
</div>
    </div>
   </div>
  </p>
 </div>

 <div class="refsect1 notes" id="refsect1-function.iconv-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    L&#039;encodage de caractères et les options disponibles dépendent de l&#039;implémentation d&#039;iconv.
    Si l&#039;argument de <code class="parameter">from_encoding</code> ou <code class="parameter">to_encoding</code> n&#039;est
    pas pris en charge sur le système actuel, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> sera retourné.
   </p>
  </p></blockquote>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.iconv-seealso">
  <h3 class="title">Voir aussi</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.mb-convert-encoding.php" class="function" rel="rdfs-seeAlso">mb_convert_encoding()</a> - Convertir une cha&icirc;ne d'un codage de caract&egrave;res &agrave; un autre</span></li>
    <li><span class="methodname"><a href="uconverter.transcode.php" class="methodname" rel="rdfs-seeAlso">UConverter::transcode()</a> - Convertit une cha&icirc;ne d'un jeu de caract&egrave;res &agrave; un autre</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>