mb_convert_encoding
mb_convert_encoding − 文字のエンコードを変換する関数です。
説明
string mb_convert_encoding ( string $str , string $to_encoding [, mixed $from_encoding ] )
文字列 strの文字エンコーディングを、 オプションで指定した from_encoding から to_encoding に変換します。
返り値
変換後の文字列を返します。
mb_convert_encoding() の使用例
<?php
/* UTF-8からShift-JISに変換 */
$str = mb_convert_encoding($str, "Shift-JIS", "UTF-8");
※変更後の文字コードを先に記述します。
/* "auto" でインプットの文字コードが不明でも適切に表示する */
$str = mb_convert_encoding($str, "Shift-JIS", "auto");
?>