[PHP-users 27294] POSTデータの文字化けについて

h.oka@netlab.club.ne.jp h.oka @ netlab.club.ne.jp
2005年 10月 25日 (火) 10:03:36 JST


岡と申します。
下記のような簡単なプログラムを作って、フォームから実行すると、
期待した結果になりません。
テキストボックスから入力された文字を表示するだけの簡単な
プログラムなのですが、
「劉」、「孫」、「表」などを入力すると、
結果表示が、「0円」だったり文字化けしたりします。
環境は、
Linux 2.6.8-1 (TurboLinux Server 10)
Apache 1.3.33
PHP 4.3.11
オプション
./configure --prefix=/usr/local/php \
 --with-apxs=/usr/local/apache/bin/apxs \
 --with-pgsql=/usr/local/pgsql \
 --with-iconv \
 --enable-mbstring \
 --enable-mbregex \
 --with-mbstring=all \
 --enable-mbstr-enc-trans \
 --with-mcrypt \
 --with-mime-magic \
 --with-gettext \
 --with-dom \
 --with-xml \
 --with-ftp \
 --with-openssl \
 --with-imap=/usr/local/lib \
 --with-imap-ssl=/usr/local/openssl \
 --enable-imap \
 --enable-gd-native-ttf \
 --with-gd=/usr/local \
 --with-freetype-dir=/usr/local \
 --with-jpeg-dir=/usr/local \
 --with-zlib=/usr/local \
 --with-png-dir=/usr/local \
 --with-pspell
なお、mbstringのオプションは、.htaccessで以下のように
設定しています。
php_value output_buffering Off
php_value mbstring.language Japanese
php_value mbstring.encoding_translation On
php_value mbstring.http_input auto
php_value mbstring.http_output EUC-JP
php_value mbstring.internal_encoding EUC-JP
php_value mbstring.detect_order auto
php_value mbstring.substitute_character none
php_value default_charset EUC-JP
# form.php
<HTML>
<HEAD>
 <meta http-equiv="Content-Type" content="text/html; charset=euc-jp">
</HEAD>
<BODY>
 <form action=form.php method=post>
 <input type=text size=20 name=message>
 <input type=submit value="送信">
 </form>
<HR>結果表示:
<?php
 if($HTTP_POST_VARS['message']){
 echo $HTTP_POST_VARS['message'];
 }
?>
</BODY>
</HTML>
---form.php end---
宜しくお願いします。


PHP-users メーリングリストの案内

AltStyle によって変換されたページ (->オリジナル) /