开发者

encode latin chars using ISO-8859-1 in PHP

开发者 https://www.devze.com 2023-02-26 03:11 出处:网络
I want to encode to ISO-885开发者_StackOverflow社区9-1 a url that contains latin characters like à, using PHP.

I want to encode to ISO-885开发者_StackOverflow社区9-1 a url that contains latin characters like à, using PHP.

The encoded string will be used to perform a request to a webservice. So if the request is:

http://www.mywebservice.com?param=à

the encoded string should be:

http://www.mywebservice.com?param=%E0

I've tried using PHP's function urlencode() but it returns the input encoded in UTF-8:

http://www.mywebservice.com?param=%C3%A0


Use utf8_decode before urlencode:

urlencode(utf8_decode("à"))
0

精彩评论

暂无评论...
验证码 换一张
取 消