|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18874 Certain Japanese characters break PHP's $_GET and $_POST
Submitted: 2002-08-13 00:44 UTC Modified: 2002-08-14 02:58 UTC
From: erica at simpli dot biz Assigned:
Status: Wont fix Package: Output Control
PHP Version: 4.1.2 OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: erica at simpli dot biz
New email:
PHP Version: OS:


 [2002-08-13 00:44 UTC] erica at simpli dot biz
I've put an example script here:

and the .phps is

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.

(SlashChick on #php)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-13 01:05 UTC]
Does this still happen with a newer version of PHP?
 [2002-08-13 02:07 UTC] erica at simpli dot biz
Still a bug in a fresh compile of 4.2.2 (on a friend's system.)

His phpinfo():

The script:

 [2002-08-13 02:15 UTC]
Actually, he probably meant the latest snapshot from
 [2002-08-13 02:40 UTC]
The spec of Shift_JIS (== one of the japanese encodings)
causes this problem. So, probably snapshots will not solve this.

As mentioned in,
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


if you have questions about japanese encoding, please ask me
directly (because here is not suitable place to do that).

 [2002-08-13 05:20 UTC]
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.
 [2002-08-14 02:58 UTC]
Also note show_source() is the much better way to show sources.

.phps has other issues, also.
Use show_source() or like.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 12 18:01:31 2024 UTC