php URL 中是否允许输入中文字符?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7184802/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Are chinese characters allowed entered in URLs?
提问by deepWebMie
Are chinese characters allowed to be entered in URLs?
网址中是否允许输入中文字符?
As tested, chinese characters are able to be entered in URLs, and it will convert to punycode as well and send out the request as well too, and reach to the related page.
经测试,URL中是可以输入汉字的,也可以转成punycode,并发出请求,到达相关页面。
But for currently, is there anybody else will do validation for website URLs to be allowed chinese character as well?
但是目前,是否还有其他人会验证网站 URL 是否也允许使用中文字符?
回答by Steve-o
Punycode exists to be able to use non-Latin scripts in non-supported software. So whilst I like my site http://見.香港/I can enter http://xn--nw2a.xn--j6w193g/if I cannot enter the Unicode original form.
Punycode 的存在是为了能够在不受支持的软件中使用非拉丁文脚本。所以虽然我喜欢我的网站http://见.香港/如果我不能输入 Unicode 原始格式,我可以输入http://xn--nw2a.xn--j6w193g/。
Some website developers program overly defensively, for example with Google Apps you cannot use punycode domains at all due to aggressive white listing that has not updated with ICANN standards.
一些网站开发人员的编程过于防御性,例如使用 Google Apps,您根本无法使用 punycode 域,因为激进的白名单尚未按照 ICANN 标准进行更新。
回答by zerkms
All non-ascii characters that presents in domain name will (should) be converted to puny-code. It is browser's business to display it as a hieroglyphs
出现在域名中的所有非 ascii 字符都将(应该)转换为 puny-code。将其显示为象形文字是浏览器的职责