“GET” method encoding French characters incorrectl

2019-07-30 20:32发布

问题:

I have a site that uses get method to get the parameters from URL. The URL has French characters is it and by using get method the characters get ruined. How can I use get method without encoding problems from French language?

The characters are written in URL this way: "http://domain.com/wt.php?id=Thor-:-Le-Monde-des-t%C3%A9n%C3%A8bres"

Then The browser URL bar encodes them correctly but the get method does not. The page itself is using "iso-8859-1" encoding.

回答1:

Maybe use UTF-8 without BOM encoding?

header('Content-type: text/html; charset=utf-8');

... in PHP and:

<meta charset="utf-8">

... in HTML.