4月 252006
 

長年の謎であった、文字コードに解決の糸口が。。。?

どうやら、mbstring.internal_encodingとは、PHPが処理をする際の文字コードのようで、たとえば、formの表示する部分をShift_jisで作ってしまった場合も

  • form.html  -  Shift_jis
  • confirm.php – EUC-jp
  • send.php – EUC-jp

というように受取側が、EUCであれば問題がないようだ。

但し、confirm.phpにおいて、表示する際は、charsetはShift_jisでありながら、ファイル自体はEUC-jpで保存しないといけないので要注意。

とりあえず、今回はこれでうまく行った感じだけど、どうなることやら。。。(というか、うちの会社のサーバーのみかもしれないし。。。)

ちなみに、.htaccessには、こう書きました。

<IfModule mod_php4.c>
php_flag    register_globals            off
php_flag    output_buffering            off
php_value    session.save_handler    files
php_value    mbstring.language            Japanese
php_value    mbstring.internal_encoding    EUC-JP
php_value    mbstring.http_input        auto
php_value    mbstring.http_output    SJIS
php_flag    mbstring.encoding_translation    on
php_flag    mbstring.detect_order    auto
php_flag    mbstring.substitute_character    none
</IfModule>

ツイートツイート

Related posts:

  1. XMLをパースしてRSSを表示!
  2. MySQL的なメモ
  3. お仕事進まず。
  4. PHPでOOP
  5. あけましておめでとうございます。

 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>