mb_convert_encoding

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 à convertir .

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

Exemple 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( ) .