システム・プログラム関連のメモや最新技術についてのメモを掲載

mb_detect_encoding() - PHP関数メモ

mb_detect_encoding — 文字エンコーディングを検出する

※mb_detect_encoding() の例


/* 現在のdetect_orderで文字エンコーディングを検出 */
echo mb_detect_encoding($str);

/* "auto" は "ASCII,JIS,UTF-8,EUC-JP,SJIS"に展開されます */
echo mb_detect_encoding($str, "auto");

/* カンマ区切りのリストで encoding_list 文字エンコーディングを指定 */
echo mb_detect_encoding($str, "JIS, eucjp-win, sjis-win");

/* encoding_list を指定するために配列を使用 */
$ary[] = "ASCII";
$ary[] = "JIS";
$ary[] = "EUC-JP";
echo mb_detect_encoding($str, $ary);
?>

You can follow any responses to this entry through the RSS 2.0 feed. Responses are currently closed, but you can trackback from your own site.

Comments are closed.