mb_convert_encoding — 转换字符的编码
string mb_convert_encoding ( string $str
, string $to_encoding
[, mixed $from_encoding
= mb_internal_encoding() ] )
/* 将 EUC-JP 转换成 UTF-7 */
$str = mb_convert_encoding($str, "UTF-7", "EUC-JP");
mb_detect_encoding — 检测字符的编码
$encode = mb_detect_encoding($keytitle, array("ASCII",‘UTF-8′,"GB2312′,"GBK",‘BIG5′));
iconv — 字符串按要求的字符编码来转换
string iconv ( string $in_charset
, string $out_charset
, string $str
)
$content = iconv("utf-8","gb2312//IGNORE",$content);
$content = iconv("gb2312","utf-8//IGNORE",$content);
mb_detect_order — 设置/获取 字符编码的检测顺序
mixed mb_detect_order ([ mixed $encoding_list
= mb_detect_order() ] )
为编码列表 encoding_list
设置自动检测字符编码的顺序。
PHP支持编码
- UCS-4*
- UCS-4BE
- UCS-4LE*
- UCS-2
- UCS-2BE
- UCS-2LE
- UTF-32*
- UTF-32BE*
- UTF-32LE*
- UTF-16*
- UTF-16BE*
- UTF-16LE*
- UTF-7
- UTF7-IMAP
- UTF-8*
- ASCII*
- EUC-JP*
- SJIS*
- eucJP-win*
- SJIS-win*
- ISO-2022-JP
- ISO-2022-JP-MS
- CP932
- CP51932
- SJIS-mac** (别名: MacJapanese)
- SJIS-Mobile#DOCOMO** (别名: SJIS-DOCOMO)
- SJIS-Mobile#KDDI** (别名: SJIS-KDDI)
- SJIS-Mobile#SOFTBANK** (别名: SJIS-SOFTBANK)
- UTF-8-Mobile#DOCOMO** (别名: UTF-8-DOCOMO)
- UTF-8-Mobile#KDDI-A**
- UTF-8-Mobile#KDDI-B** (别名: UTF-8-KDDI)
- UTF-8-Mobile#SOFTBANK** (别名: UTF-8-SOFTBANK)
- ISO-2022-JP-MOBILE#KDDI** (别名: ISO-2022-JP-KDDI)
- JIS
- JIS-ms
- CP50220
- CP50220raw
- CP50221
- CP50222
- ISO-8859-1*
- ISO-8859-2*
- ISO-8859-3*
- ISO-8859-4*
- ISO-8859-5*
- ISO-8859-6*
- ISO-8859-7*
- ISO-8859-8*
- ISO-8859-9*
- ISO-8859-10*
- ISO-8859-13*
- ISO-8859-14*
- ISO-8859-15*
- byte2be
- byte2le
- byte4be
- byte4le
- BASE64
- HTML-ENTITIES
- 7bit
- 8bit
- EUC-CN*
- CP936
- GB18030**
- HZ
- EUC-TW*
- CP950
- BIG-5*
- EUC-KR*
- UHC (CP949)
- ISO-2022-KR
- Windows-1251 (CP1251)
- Windows-1252 (CP1252)
- CP866 (IBM866)
- KOI8-R*
时间: 2024-10-05 05:21:27