punycode

Is there any way to avoid showing “xn--” for IDN domains?

馋奶兔 提交于 2021-02-20 19:00:00
问题 If I use a domain such as www.äöü.com , is there any way to avoid it being displayed as www.xn--4ca0bs.com in users’ browsers? Domains such as www.xn--4ca0bs.com cause a lot of confusion with average internet users, I guess. 回答1: This is entirely up to the browser. In fact, IDNs are pretty much a browser-only technology. Domain names cannot contain non-ASCII characters, so the actual domain name is always the Punycode encoded xn--... form. It's up to the browser to prettify this, but many

Is there any way to avoid showing “xn--” for IDN domains?

放肆的年华 提交于 2021-02-20 18:59:12
问题 If I use a domain such as www.äöü.com , is there any way to avoid it being displayed as www.xn--4ca0bs.com in users’ browsers? Domains such as www.xn--4ca0bs.com cause a lot of confusion with average internet users, I guess. 回答1: This is entirely up to the browser. In fact, IDNs are pretty much a browser-only technology. Domain names cannot contain non-ASCII characters, so the actual domain name is always the Punycode encoded xn--... form. It's up to the browser to prettify this, but many

Problem in converting string to puny code (in PHP, using phlyLabs's punycode string converter)

旧巷老猫 提交于 2019-12-25 09:29:30
问题 i'm using the code from here: http://phlymail.com/en/downloads/idna/download/ and built a function like this (from the example): function convert_to_punycode($inputstring) { $IDN = new idna_convert(); // The input string, if input is not UTF-8 or UCS-4, it must be converted before $inputstringutf8 = utf8_encode($inputstring); // Encode it to its punycode presentation $outputstringpunycode = $IDN->encode($inputstringutf8); return $outputstringpunycode; } However it doesnt work properly. For

What is the maximum length of an IDNA converted domain name?

大兔子大兔子 提交于 2019-12-21 04:12:06
问题 First things first: I'm storing multiple domains to a database, after I've converted each and every domain name to it's IDNA version. What I need to know the maximum length such an IDNA-converted domain name can have so I can define the database field's max length. Known fact: Now, I know the maximum number of characters in a domain name (including any subdomains) is 255 characters. Where I lost it: That's easy at first glance, but... does this mean regular ascii characters of international

Efficient way to ASCII encode UTF-8

浪尽此生 提交于 2019-12-11 02:49:28
问题 I'm looking for a simple and efficient way to store UTF-8 strings in ASCII-7. With efficient I mean the following: all ASCII alphanumeric chars in the input should stay the same ASCII alphanumeric chars in the output the resulting string should be as short as possible the operation needs to be reversable without any data loss the resulting ASCII string should be case insensitive there should be no restriction on the input length the whole UTF-8 range should be allowed My first idea was to use

Do browsers encode in punycode only domain or whole url?

橙三吉。 提交于 2019-12-10 18:12:56
问题 I was reading about IDN homograph atack and didn't find exactly stated does browsers encode in punycode only domain or rest of the URL is included (path and query). So my question is does one of popular browsers (FF, IE, Chrome, Safari, Opera) encode rest of the URL (IRI to be exact) with punycode ? 回答1: Only the domain name part is encoded with punycode. This is due to the restrictions imposed on the allowable characters in a (traditional) domain name. The path part of the URL has no such

Convert non-ascii domain to SMTP compatible

狂风中的少年 提交于 2019-12-06 07:40:59
问题 When customers enter email addresses with non-ascii chars like äüö our SMTP rejects to process them. So I think might be there is a solution to handle those domains myself and convert them to punyocode. Is there a simple way of doing so using c#? Would this work anyway? 回答1: You can use Uri.DnsSafeHost to convert to Punycode: using System; class Test { static void Main() { Console.WriteLine(ConvertToPunycode("caf\u00e9.com")); } static string ConvertToPunycode(string domain) { Uri uri = new