PHP encoding failure.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tgckpg
Forum Newbie
Posts: 7
Joined: Sun Feb 07, 2010 11:09 am

PHP encoding failure.

Post 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?
User avatar
greyhoundcode
Forum Regular
Posts: 613
Joined: Mon Feb 11, 2008 4:22 am

Re: PHP encoding failure.

Post 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?
tgckpg
Forum Newbie
Posts: 7
Joined: Sun Feb 07, 2010 11:09 am

Re: PHP encoding failure.

Post by tgckpg »

uft-8 through textarea, sent using XHR.
tgckpg
Forum Newbie
Posts: 7
Joined: Sun Feb 07, 2010 11:09 am

Re: PHP encoding failure.

Post by tgckpg »

Fixed. I just re-installed the system. And everything works fine.
Post Reply