- 2009-06-30 (火)
wordpressの携帯表示用プラグインmobile eye + を使うとなぜかタイトルの文字化けだけ直せない。
mobile_title()でエンコードさせてもだめ。
果てはテーマファイルのタイトルタグ直書きしても化ける。
ここでどこかでタイトルがリライトされていることに気づく・・・。
探してみるとプラグインのall in one seo だった。
同プラグインの
1040行目あたり
- function replace_title($content, $title) {
- $title = trim(strip_tags($title));
の直後に
- if ((function_exists('is_mobile'))&&(is_mobile() == true)) {
- $title = mb_convert_encoding($title ,"shift_jis");
- }
と追加してsjisにエンコードしてあげましょう。
尚php.iniなどでmb_internal_encoding
を指定していない場合は上のコードの変わりに
- if ((function_exists('is_mobile'))&&(is_mobile() == true)) {
- $title = mb_convert_encoding($title ,"shift_jis" , "euc-jp");//第三引数で使用中文字コードを指定してください
- //utf-8 なら 上の行を $title = mb_convert_encoding($title ,"shift_jis" , "utf-8"); にしてください
- }
- //get_settings("blog_charset") などwordpressの内部関数を使用しても良いかも?すみません試していません
を追加してください。
- 次の記事: PHP4とmysql5の組み合わせについてメモ
- 前の記事: 初めてのbake cakephp1.2 windowsXP
Comments:0
Trackback+Pingback:0
- TrackBack URL for this entry
- http://reoto.com/archives/258/trackback/
- Listed below are links to weblogs that reference
- mobile eye でタイトルの文字化け対策 メモ from ぼんずーず