Skip to content

Instantly share code, notes, and snippets.

@dataich
Created December 4, 2009 12:58
Show Gist options
  • Save dataich/249011 to your computer and use it in GitHub Desktop.
Save dataich/249011 to your computer and use it in GitHub Desktop.
<?php
//
// 画面出力時に、テンプレートをUTF-8からSJISに変換する。
//
function filterUTF8ToSJIS($buff, &$smarty) {
return mb_convert_encoding($buff,"SJIS","UTF-8");
}
$smarty= new Smarty(); //Smartyオブジェクト生成
$smarty->register_outputfilter("filterUTF8ToSJIS"); //フィルターの登録
ini_set("default_charset", "Shift_JIS"); //PHPの設定default_charsetにSJISを設定
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment