#18874 [Fbk]: Certain Japanese characters break PHP's $_GET and $_POST
| From: | wez@php.net | Date: | Tue, 13 Aug 2002 09:20:22 +0000 |
| Subject: | #18874 [Fbk]: Certain Japanese characters break PHP's $_GET and $_POST | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-16588@lists.php.net to get a copy of this message | ||
ID: 18874
Updated by: wez@php.net
Reported By: erica@simpli.biz
Status: Feedback
Bug Type: Output Control
Operating System: Windows XP
PHP Version: 4.1.2
New Comment:
Also note that (for IE at least), you can force a more
sensible encoding to be used by adding an ACCEPTCHARSET
attribute to your form:
<form acceptcharset="utf-8" ...>
This will cause the data to be utf-8 encoded.
And you should definitely be running with the mbstring
module if you are dealing with Japanese text.
Previous Comments:
------------------------------------------------------------------------
[2002-08-13 02:40:44] fujimoto@php.net
The spec of Shift_JIS (== one of the japanese encodings)
causes this problem. So, probably snapshots will not solve this.
As mentioned in http://www.php.net/manual/en/ref.mbstring.php,
using Shift_JIS as the script encoding or internal encoding is NOT
recommended.
Anyway, currently we have two workarounds.
1. use EUC-JP as script encoding
2. use snapshots w/ following settings:
- enable zend engine to parse shift jis
./configure --enable-zend-multibyte [and so on]
- enable encoding translation
add following lines to your php.ini
[mbstring]
mbstring.internal_encoding=euc-jp
mbstring.output_encoding=shift_jis
mbstring.script_encoding=shift_jis
mbstring.encoding_translation=1
if you have questions about japanese encoding, please ask me
directly (because here is not suitable place to do that).
------------------------------------------------------------------------
[2002-08-13 02:15:32] rasmus@php.net
Actually, he probably meant the latest snapshot from snaps.php.net
------------------------------------------------------------------------
[2002-08-13 02:07:13] erica@simpli.biz
Still a bug in a fresh compile of 4.2.2 (on a friend's system.)
His phpinfo():
http://redline.worldforge.org/en/info.php
The script:
http://redline.worldforge.org/hottie/contact2.php
Thanks.
------------------------------------------------------------------------
[2002-08-13 01:05:28] kalowsky@php.net
Does this still happen with a newer version of PHP?
------------------------------------------------------------------------
[2002-08-13 00:44:01] erica@simpli.biz
I've put an example script here:
http://clients.simpli.biz/contact.php
and the .phps is
http://clients.simpli.biz/contact.phps
Basically, there is a specific Japanese character that translates to a
[ in ASCII. Since this character contains a [, PHP treats this as the
beginning of an array, and since it sees no ending delimiter, it
ignores that form field. Any form input with that character then
becomes broken in PHP. Since it is a fairly common character, this has
a large impact.
Go to the script above and change your character encoding, and you'll
see exactly what I mean. When you hit Submit, the script just prints
out all submitted variables. Any form inputs with a name containing
that character do not submit at all.
Thanks,
Erica
(SlashChick on irc.openprojects.net #php)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18874&edit=1