Forum und email

mb_convert_encoding

(PHP 4 >= 4.0.6, PHP 5)

mb_convert_encoding — Conversion d'encodage

Description

string mb_convert_encoding ( string $str , string $to_encoding [, mixed $from_encoding ] )

mb_convert_encoding() convertit la chaîne str depuis l'encodage from_encoding vers l'encodage to_encoding .

str : chaîne de caractères à convertir.

from_encoding est l'encodage de la chaîne str à l'origine. Il sera détecté parmi plusieurs encodages fournis sous forme d'un tableau, ou d'une liste d'encodages séparés par des virgules.

Example#1 Exemple avec mb_convert_encoding()

<?php
/* Convertit l'encodage interne vers SJIS */
$str mb_convert_encoding($str"SJIS");
/* Convertit EUC-JP en UTF-7 */
$str mb_convert_encoding($str"UTF-7""EUC-JP");
/* Détecte automatiquement un encodage entre JIS, eucjp-win ou sjis-win,
   Puis convertit en UCS-2LE */
$str mb_convert_encoding($str"UCS-2LE""JIS, eucjp-win, sjis-win");
/* "auto" signifie "ASCII,JIS,UTF-8,EUC-JP,SJIS" */
$str mb_convert_encoding($str"EUC-JP""auto");
?>

Voir aussi mb_detect_order().