Bug #78307 [Opn->Nab]: Strange caracter in $_POST with mbstring.encoding_translation = On

From: Date: Thu, 18 Jul 2019 00:44:20 +0000
Subject: Bug #78307 [Opn->Nab]: Strange caracter in $_POST with mbstring.encoding_translation = On
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221850@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78307&edit=1 ID: 78307 Updated by: yohgaki@php.net Reported by: heidy dot hery at gmail dot com Summary: Strange caracter in $_POST with mbstring.encoding_translation = On -Status: Open +Status: Not a bug Type: Bug Package: mbstring related Operating System: Windows 10 PHP Version: 7.3.7 Block user comment: N Private report: N New Comment: In general, you shouldn't use automatic encoding translation because current HTML specification explicitly states client(browser) must send specified char encoding. In addition, automatic encoding detection requires long and unique enough char data for correct detection. Your input should be short and/or not unique. Set mbstring.http_input = UTF-8 or none. Previous Comments: ------------------------------------------------------------------------ [2019-07-17 18:55:34] heidy dot hery at gmail dot com Hello, my default parameters in php.ini is : ------------------------------------------------------- ; PHP's built-in default media type is set to text/html. ; http://php.net/default-mimetype default_mimetype = "text/html" ; PHP's default character set is set to UTF-8. ; http://php.net/default-charset default_charset = "UTF-8" ; PHP internal character encoding is set to empty. ; If empty, default_charset is used. ; http://php.net/internal-encoding ;internal_encoding = ; PHP input character encoding is set to empty. ; If empty, default_charset is used. ; http://php.net/input-encoding ;input_encoding = ; PHP output character encoding is set to empty. ; If empty, default_charset is used. ; See also output_buffer. ; http://php.net/output-encoding ;output_encoding = ----------------------------------------------- I use in all my html/php file the header : <meta charset="utf-8"/> or <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> in my httpd.conf I add the line : AddDefaultCharset utf-8 But that's doesn't change anything, I've put also accept-charset="utf-8" in the form attribute. The only thing that's worked it's when I've put the "http_input" to UTF-8 and turn off the "encoding_translation". ------------------------------------------------------------------------ [2019-07-17 16:17:20] requinix@php.net What's the value of your default_charset setting? Are your pages being served in UTF-8 encoding or something else? ------------------------------------------------------------------------ [2019-07-17 15:16:06] heidy dot hery at gmail dot com Description: ------------ Description : When I use multipart/form-data for posting data to the php side. The $_POST variable output strange caracter like "réveiller". in place of "réveiller". But I've tested two sites. with the same Apache/PHP configuration... and on the first site, multipart/form-data work correctly, but not on the second site... it's a very strange and non stable behaviour. the php.ini configuration was as follow : mbstring.internal_encoding = UTF-8 mbstring.http_input = auto mbstring.encoding_translation = On I've made a test with enctype="application/x-www-form-urlencoded" and the data showed correctly in the $_POST array. So in order to have the correct behaviour with enctype="multipart/form-data", I've to set the following value in php.ini mbstring.internal_encoding = UTF-8 mbstring.http_input = UTF-8 mbstring.encoding_translation = Off Now all is working correctly. my php version is 7.3.5 apache 2.4.39 Windows 10 x64. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78307&edit=1

« previous php.bugs (#221850) next »