(PHP 4 >= 4.0.6, PHP 5)
mb_convert_encoding — Conversion d'encodage
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.
Exemple 1544. 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() .