12月 082006
 

新しいサーバーをいじるときに必ずやらなければ行けないこと。

それは日本語、マルチバイトテキストの設定なのだ。

そうしないと、PHPでメールを送るときにmb_encoding_mimeheaderを使ってメールのタイトルを変換したとしても、文字化けしてしまうらしい。

PHPのmb_encode_mimeheaderは事前にmb_internal_encodingが必要

ということらしい。

php.iniで設定をしても、ソース内で処理をしても良いのかな?このサイトのソースはPHP5らしいので、PHP4の人は違うかもしれませんが、いろいろと不都合が起こらないよう環境を統一しておくためにphp.iniできちんとmbの項目を設定しておきましょう。

ちなみに、設定した値は

output_buffering         = Off
magic_quotes_gpc = Off
default_charset          = EUC-JP

mbstring.language = Japanese
mbstring.internal_encoding = EUC-JP
mbstring.http_input  = auto
mbstring.http_output = EUC-JP
mbstring.encoding_translation = On
mbstring.detect_order = auto
mbstring.substitute_character = none

こんな感じですかね。

そんなこんなで仕事が滞っています。。。

ツイートツイート

Related posts:

  1. PHPメモ:mb_convert_encodingの挙動
  2. PHP+XMLメモ
  3. XML_RPCのリクエストとレスポンスに関するメモ
  4. internal_encodingの謎
  5. ereg_replaceの初歩的なミス

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>