[PHP-users 13335] mbstringのHTTP入力変換されない

Nukamori T. php-users@php.gr.jp
Mon, 17 Feb 2003 18:34:19 +0900


糠盛です。
# 久しぶりの投稿です。

Mac OS X 10.2.4で、PHP 4.3.0を使おうとしています。
php.iniに、"mbstring.encoding_translation = On"を
指定しているのですが、HTTP入力変換ができません。

configureでは次のようにして試しています。
-------------------------------------------------
OPTS="${OPTS} --prefix=/usr/local"
OPTS="${OPTS} --with-config-file-path=/etc/httpd"
OPTS="${OPTS} --enable-force-cgi-redirect"
OPTS="${OPTS} --enable-mbstring"
./configure ${OPTS}
-------------------------------------------------

php.iniの関係しそうな部分は次のように指定しています。
-------------------------------------
output_buffering = On
output_handler = mb_output_handler
zlib.output_compression = Off
mbstring.language = Japanese
mbstring.internal_encoding = EUC-JP
mbstring.http_input = auto
mbstring.http_output = SJIS
mbstring.encoding_translation = On
mbstring.detect_order = auto
mbstring.substitute_character = long;
mbstring.func_overload = 0
mbstring.internal_encoding 
-------------------------------------
phpinfo()で反映されているのを確認しています。

下記のような単純なコードで試してみましたが、
"検証"といれると、"BAD+8CBAD+9F"になってしまいます...
----------------------------------------------------------------------
<html><body>
<form method="POST" action="<?php print( $_SERVER['PHP_SELF'] ); ?>">
<input type="text"   name="test">
<input type="submit" value="submit">
</form>
<pre>
text:                  <?php print( $_POST['test'] ); ?>

mb_detect_encoding():  <?php print(
                        mb_detect_encoding( $_POST['test'] ) ); ?>

mb_internal_encoding():<?php print( mb_internal_encoding() ); ?>

mb_http_input():       <?php print( mb_http_input() ); ?>

mb_http_output():      <?php print( mb_http_output() ); ?>

mb_convert_encoding(): <?php print(
        mb_convert_encoding( $_POST['test'], "EUC-JP", "SJIS" ) ); ?>

</pre>
</body></html>
----------------------------------------------------------------------

いちおうPHP4.3で変わった点は押さえて設定している*つもり*ですが、
同じような環境でこういった状況になっている方、いませんでしょうか?

よろしくお願いします。


----------------------------------------------------------------------
(有)大入ネット 糠盛 創(ぬかもり つくる)
 tel:03-3631-3176 / fax:03-3631-3179
 mailto:nuka@ooiri.net / http://www.ooiri.net/