Jump to content

Umangling UTF-8 POST data (eg %C4%80 becoming 0x3F)?


MartinHowe

Recommended Posts

Please does anybody have a workaround or suggestions for a script that is expecting UTF-8 everywhere but does not get it because PHP (or something else lower under the hood) seems to ignore the headers? The http headers and content type headers emitted all state utf-8 for the charset, application/x-www-form-urlencoded, etc.

 

On my development server (XAMPP 1.7.3, PHP 5.3.1, Apache 2.2.14, Windows 7) it works fine; pasting a unicode character from Windows 0x0100 (Ā) gets sent in the http header as %C4%80 and is passed through as 0xC480, no problem.

 

However, on the production server (rented so I have no control over the software versions, PHP 5.2.13, Apache 2.2.15, CentOS), the %C4%80 in the header is translated into a question mark (0x3F) directly; i.e.:

echo(bin2hex($_POST['field-name']))

returns '3f'.

 

I can't find any reference to this via google or even here, but perhaps am using the "wrong" search terms. Does anybody know a work-around for this or am I doing something stupefyingly, well, stupid :(

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.