<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/filters.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'filters.convert.php',
    1 => 'Filtres de conversion',
    2 => 'Filtres de conversion',
  ),
  'up' => 
  array (
    0 => 'filters.php',
    1 => 'Liste des filtres disponibles',
  ),
  'prev' => 
  array (
    0 => 'filters.string.php',
    1 => 'Filtres de cha&icirc;nes de caract&egrave;res',
  ),
  'next' => 
  array (
    0 => 'filters.compression.php',
    1 => 'Filtres de compression',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'appendices/filters.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="filters.convert" class="section">
  <h2 class="title">Filtres de conversion</h2>

  <p class="simpara">
   Comme pour les filtres de <a href="language.types.string.php" class="link">chaîne de caractères</a>, les filtres de conversion
   font ce que leur nom indique.
   Pour plus d&#039;informations sur un filtre donné, se référer à la page du
   manuel de la fonction correspondante.
  </p>

  <div class="section" id="filters.convert.base64">
   <h2 class="title">convert.base64-encode et convert.base64-decode</h2>
   <p class="simpara">
    L&#039;utilisation de ce filtre est équivalente à traiter toutes les données
    du flux à travers les fonctions <span class="function"><a href="function.base64-encode.php" class="function">base64_encode()</a></span> et
    <span class="function"><a href="function.base64-decode.php" class="function">base64_decode()</a></span> respectivement.
    <code class="literal">convert.base64-encode</code> supporte les paramètres sous forme
    de <a href="language.types.array.php" class="link">tableau</a> associatif. Si <code class="parameter">line-length</code> est fourni,
    la sortie base64 sera séparée en lignes de <code class="parameter">line-length</code>
    caractères. Si <code class="parameter">line-break-chars</code> est fourni, chaque
    bloc de caractères sera délimité par le caractère fourni. Ces paramètres
    donnent le même effet que la fonction <span class="function"><a href="function.base64-encode.php" class="function">base64_encode()</a></span>
    utilisée conjointement avec <span class="function"><a href="function.chunk-split.php" class="function">chunk_split()</a></span>.
   </p>
   <div class="example" id="example-1">
    <p><strong>Exemple #1 
     convert.base64-encode &amp;
     convert.base64-decode
    </strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$fp </span><span style="color: #007700">= </span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">'php://output'</span><span style="color: #007700">, </span><span style="color: #DD0000">'w'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">stream_filter_append</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #DD0000">'convert.base64-encode'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #DD0000">"This is a test.\n"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">/* affiche :  VGhpcyBpcyBhIHRlc3QuCg==  */<br /><br /></span><span style="color: #0000BB">$param </span><span style="color: #007700">= array(</span><span style="color: #DD0000">'line-length' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">8</span><span style="color: #007700">, </span><span style="color: #DD0000">'line-break-chars' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"\r\n"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$fp </span><span style="color: #007700">= </span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">'php://output'</span><span style="color: #007700">, </span><span style="color: #DD0000">'w'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">stream_filter_append</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #DD0000">'convert.base64-encode'</span><span style="color: #007700">, </span><span style="color: #0000BB">STREAM_FILTER_WRITE</span><span style="color: #007700">, </span><span style="color: #0000BB">$param</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #DD0000">"This is a test.\n"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">/* affiche :  VGhpcyBp<br />           :  cyBhIHRl<br />           :  c3QuCg==  */<br /><br /></span><span style="color: #0000BB">$fp </span><span style="color: #007700">= </span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">'php://output'</span><span style="color: #007700">, </span><span style="color: #DD0000">'w'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">stream_filter_append</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #DD0000">'convert.base64-decode'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #DD0000">"VGhpcyBpcyBhIHRlc3QuCg=="</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">/* affiche :  This is a test.  */<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </div>

  <div class="section" id="filters.covert.quoted-printable">
   <h2 class="title">convert.quoted-printable-encode et convert.quoted-printable-decode</h2>
   <p class="simpara">
    L&#039;utilisation de la version decode de ce filtre est équivalente à traiter toutes
    les données du flux à travers la fonction
    <span class="function"><a href="function.quoted-printable-decode.php" class="function">quoted_printable_decode()</a></span>. Il n&#039;y a pas d&#039;équivalent
    fonctionnel à <code class="literal">convert.quoted-printable-encode</code>.
   <code class="literal">convert.quoted-printable-encode</code> supporte les paramètres
    sous forme de <a href="language.types.array.php" class="link">tableau</a> associatif. En plus des paramètres supportés par
   <code class="literal">convert.base64-encode</code>, <code class="literal">convert.quoted-printable-encode</code>
    accepte aussi les arguments <a href="language.types.boolean.php" class="link">booléen</a> <code class="parameter">binary</code> et
    <code class="parameter">force-encode-first</code>.
    <code class="literal">convert.base64-decode</code> supporte uniquement le paramètre
    <code class="parameter">line-break-chars</code> en tant qu&#039;indicateur de type pour
    l&#039;extraction de la charge codée.
   </p>
   <div class="example" id="example-2">
    <p><strong>Exemple #2 
     convert.quoted-printable-encode &amp;
     convert.quoted-printable-decode
    </strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$fp </span><span style="color: #007700">= </span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">'php://output'</span><span style="color: #007700">, </span><span style="color: #DD0000">'w'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">stream_filter_append</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #DD0000">'convert.quoted-printable-encode'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #DD0000">"This is a test.\n"</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">/* affiche :  =This is a test.=0A  */<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </div>

  <div class="section" id="filters.convert.iconv">
   <h2 class="title">convert.iconv.*</h2>
   <p class="simpara">
    Les filtres <code class="literal">convert.iconv.*</code> sont disponibles, si le support
    de <a href="book.iconv.php" class="link">iconv</a> est activé, et leurs usages sont
    équivalents à traiter toutes les données du flux avec <span class="function"><a href="function.iconv.php" class="function">iconv()</a></span>.
    Ces filtres ne supportent pas de paramètres, mais s&#039;attendent à la place à ce que
    le nom du filtre contienne l&#039;encodage des données en saisie et de sortie, c.-à-d.
    <code class="literal">convert.iconv.&lt;input-encoding&gt;.&lt;output-encoding&gt;</code> ou
    <code class="literal">convert.iconv.&lt;input-encoding&gt;/&lt;output-encoding&gt;</code>
    (les deux notations sont sémantiquement équivalentes).
   </p>

   <div class="example" id="example-3">
    <p><strong>Exemple #3 convert.iconv.*</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$fp </span><span style="color: #007700">= </span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">'php://output'</span><span style="color: #007700">, </span><span style="color: #DD0000">'w'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">stream_filter_append</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #DD0000">'convert.iconv.utf-16le.utf-8'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #DD0000">"T\0h\0i\0s\0 \0i\0s\0 \0a\0 \0t\0e\0s\0t\0.\0\n\0"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">/* Affiche : This is a test. */<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

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