【问题标题】:How to convert a domain name to its UTF-8 version?如何将域名转换为其 UTF-8 版本?
【发布时间】:2022-06-15 20:54:41
【问题描述】:

如何转换 URL,如:

https://danielabruña.com/
https://fagualópez.com/
https://laconspiracióndelcastellano.com/

到他们的 UTF-8 编码变体?

【问题讨论】:

  • 他们不是 utf-8?您是指带有 urlencoding 的 ascii 吗?
  • 请举例说明你想得到什么
  • 如果名称中有ñó 等,并不意味着它们已经使用UTF-8

标签: php


【解决方案1】:

使用“utf8_encode”:

echo(utf8_encode("https://danielabruña.com/")); 
echo(utf8_encode("https://fagualópez.com/")); 
echo(utf8_encode("https://laconspiracióndelcastellano.com/")); 

结果:

https://danielabruña.com/

https://fagualópez.com/

https://laconspiracióndelcastellano.com/

【讨论】:

    猜你喜欢
    • 2015-04-13
    • 1970-01-01
    • 1970-01-01
    • 2014-02-02
    • 2015-09-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多