“GET” method encoding French characters incorrectly in PHP

不羁的心 提交于 2019-12-11 06:26:07

问题


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.



来源:https://stackoverflow.com/questions/19757767/get-method-encoding-french-characters-incorrectly-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!