【问题标题】:encode latin chars using ISO-8859-1 in PHP在 PHP 中使用 ISO-8859-1 编码拉丁字符
【发布时间】:2011-04-18 09:01:27
【问题描述】:

我想使用 PHP 将包含 à 等拉丁字符的 URL 编码为 ISO-8859-1。

编码后的字符串将用于执行对 Web 服务的请求。所以如果请求是:

http://www.mywebservice.com?param

编码后的字符串应该是:

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

我尝试过使用 PHP 的函数 urlencode() 但它返回以 UTF-8 编码的输入:

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

【问题讨论】:

    标签: php url-encoding iso-8859-1


    【解决方案1】:

    urlencode之前使用utf8_decode

    urlencode(utf8_decode("à"))
    

    【讨论】:

      猜你喜欢
      • 2017-01-04
      • 1970-01-01
      • 1970-01-01
      • 2016-11-26
      • 2014-01-18
      • 2019-12-17
      • 1970-01-01
      • 1970-01-01
      • 2014-01-17
      相关资源
      最近更新 更多