77;20202;0ccatbody - よくきたWiki

Loading ...



$detect_charset = "";
$phrase = empty( $_POST[ "phrase"]) == TRUE? "": $_POST[ "phrase"];
if ( $phrase != "") {
    $charsets = array( "UTF-8", "EUC-JP", "Shift_JIS", "ISO-2022-JP");
    foreach ( $charsets as $charset) {


        if ( $phrase == mb_convert_encoding( $phrase, $charset, $charset)) {

            $detect_charset = $charset;
            break;
        }
    }
}

$ echo '<?xml encoding="UTF-8" ?>' | \
  php -r '
  $string = file_get_contents( "php://stdin");
  var_dump( preg_match( "/encoding=[\"]?[^\" \t>]+/", $string, $matches));
  var_dump( $matches);'
int(1)
array(1) {
  [0]=>
  string(14) "encoding=UTF-8"
}

mb_internal_encoding( "UTF-8");
mb_regex_encoding( "UTF-8");

  • ISO-2022-JP
  • CP932

  php -r 'echo mb_convert_encoding( file_get_contents( "php://stdin"), "EUC-JP", "UTF-8");'
  php -r 'echo mb_convert_encoding( file_get_contents( "php://stdin"), "EUCJP-WIN", "UTF-8");'

mb_language( "ja");
mb_internal_encoding( "UTF-8");

$subject = mb_convert_encoding( $subject, "ISO-2022-JP", "UTF-8");
mb_internal_encoding( "ISO-2022-JP");
$encode_subject = mb_encode_mimeheader( $subject, "ISO-2022-JP");
mail( "foo@example", $encode_subject, "test", "From: bar@example.com");
mb_language( "ja");
mb_internal_encoding( "UTF-8");

$encode_subject = mb_encode_mimeheader( $subject
mail( "foo@example", $encode_subject, "test", "From: bar@example.com");

*1



*1
リロード   新規 編集 凍結 差分 添付 複製 改名   トップ 一覧 検索 最終更新 バックアップ   ヘルプ   最終更新のRSS
最終修正日時: Sun, 15 Feb 2009 00:25:27 JST (3201d)
文字数(HTML): 1758
文字数(Wiki): 5520
人気ブログランキング - よくきた wiki