Edit report at https://bugs.php.net/bug.php?id=63094&edit=1
ID: 63094 Comment by: tomas dot glabasna at seznam dot cz Reported by: seven at nivas dot hr Summary: Different behavior of $_POST data when setting mbstring.internal_encoding on ru Status: Not a bug Type: Bug Package: mbstring related Operating System: windows & unix PHP Version: 5.4.7 Block user comment: N Private report: N New Comment: I tested with the new Firefox and Chrome PHP 5.4.18 - Problem PHP 5.3.3 and 5.2.14 is OK var_dump(mb_detect_order()); // array(2) { [0]=> string(5) "ASCII" [1]=> string(5) "UTF-8" } Previous Comments: ------------------------------------------------------------------------ [2013-08-20 14:10:52] a...@php.net Related To: Bug #65488 ------------------------------------------------------------------------ [2013-06-29 05:31:59] yohg...@php.net Input encoding translation is used when browser are wrongly implemented. Currently used browsers send the charset as the page. So translation is not needed. Exception is mobile or old devices. If you have to use this feature, change mbstring.detect_order and 'always supply enough data to detect encoding correctly' ------------------------------------------------------------------------ [2012-09-15 12:42:09] seven at nivas dot hr Description: ------------ I am unaware if this is a bug or feature, but itâs strange. It should be fixed or documented somewhere. Iâve run into this in process of debugging a problem I was having with old code running on php 5.4 and php 5.4.7 which caused all utf8 form data to be submitted in wrong encoding. Instead of â[Å¡ÄÄÄž]â I would get â[à ¡ÃÂÃÂÃÂà ¾]â. After a while I've found out that because of the utf8 changes implemented into php 5.4.x mbstring.http_input=auto should be set to âpassâ. my php.ini has default_charset = "UTF-8" and my form is on utf8 html page and <form tag has accept-charset="utf-8". Imagine having this in .htaccess file: php_value mbstring.encoding_translation 1 php_value mbstring.internal_encoding UTF-8 php_value mbstring.http_input auto and this in php: echo $_POST['test']; // outputs [à ¡ÃÂÃÂÃÂà ¾] php ini_get sees this, so all settings are applied ok: mbstring.internal_encoding:UTF-8 mbstring.encoding_translation:1 mbstring.http_input:auto The utf8 form data problem occurs. Now, imagine having only this in .htaccess (since encoding_translation is PHP_INI_PERDIR setting and canât be set from runtime): php_value mbstring.encoding_translation 1 and this in php: mb_internal_encoding ('UTF-8'); mb_http_input('auto'); echo $_POST['test']; // outputs [Å¡ÄÄÄž] php ini_get sees this, so all settings are applied ok: mbstring.internal_encoding:UTF-8 mbstring.encoding_translation:1 mbstring.http_input:auto No utf8 data form submission problem. mbstring.internal_encoding is PHP_INI_ALL setting, however, it does not behave the same if set from .htaccess or .php. It seems to me that setting it from .php does not make any change in how mbstring.http_input will process form data. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63094&edit=1