JohnDotOwl
JohnDotOwl

Reputation: 3755

URL Encoding - Chinese Charcters

When i paste 圆通速递 into a website and check the POST using FIREBUG ,it gave me the following

%D4%B2%CD%A8%CB%D9%B5%DD

申通E物流 is becomeing 鐢抽€欵鐗╂祦 after i URL encode and the website decodes it obviously urlencode($trackingname); didn't work out well :(

How do i encode my Chinese character to that same format as the website is doing?My chinese character is stored in mysql. I tried decoding using some format but cant return it to that Chinese character pasted.

Any help would be greatly appreciated! Thank you

Upvotes: 0

Views: 1182

Answers (1)

Vadim Kononov
Vadim Kononov

Reputation: 2184

Your website must use UTF-8. In HTML5 that would be (HTML):

<meta charset="UTF-8">

When you connect to your Database, be sure to use (PHP):

$mysqli->set_charset("utf8");

Finally, your table definition that stores Chinese characters must also have UTF-8 collation (SQL):

`column name` TEXT CHARACTER SET utf8

Upvotes: 2

Related Questions