Page 1 of 1

PHP encoding failure.

Posted: Sat Apr 16, 2011 9:54 pm
by tgckpg
Via POST, I send a string "中文" to php.
Using file_get_contents("php://input") gets "%E4%B8%AD%E6%96%87".
Using $_POST["data"] gets "??".

Why?

Re: PHP encoding failure.

Posted: Sun Apr 17, 2011 1:00 am
by greyhoundcode
Not really sure in all honesty. As a practical measure it might be worth investigating if mb_convert_encoding() can help.

Can you tell us what sort of encoding is used to create those characters in the first place?

Re: PHP encoding failure.

Posted: Sun Apr 17, 2011 1:20 am
by tgckpg
uft-8 through textarea, sent using XHR.

Re: PHP encoding failure.

Posted: Mon Apr 18, 2011 10:30 am
by tgckpg
Fixed. I just re-installed the system. And everything works fine.