idn

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

idn_to_ascii() in 5.2.17

旧巷老猫 提交于 2021-02-20 11:50:45
问题 There's a very handy function idn_to_ascii() in PHP 5.3, but I'm running 5.2.17 and I can't change that. How do I encode Unicode domain names to ascii then? 回答1: Peter's answer gives you the official IDN functions in PHP 5.2, and if possible it's probably the best answer. However some users will be unable to install a PECL library on their PHP system, so they would need to have a conversion library written in plain PHP which they can just include within their own code. Fortunately there is a

Can Not Read UNICODE URL in C#

天涯浪子 提交于 2021-02-08 04:39:18
问题 The following code won't work: using System; using System.IO; using System.Net; using System.Web; namespace Proyecto_Prueba_04 { class Program { /// <summary> /// /// </summary> /// <param name="url"></param> /// <returns></returns> public static string GetWebText(string url) { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); request.UserAgent = "A .NET Web Crawler"; WebResponse response = request.GetResponse(); Stream stream = response.GetResponseStream(); StreamReader

How to enable IDN/IRI Support for URI-Class by code?

筅森魡賤 提交于 2020-06-12 06:37:07
问题 I'm trying to enable the IDN/IRI support for the URI class, because I need the "Uri.IsWellFormedUriString" method on german umlaut-domains (e.g. www.bücher.de). I found similar question at https://stackoverflow.com/a/6107682/413531 (taken from http://msdn.microsoft.com/en-us/library/system.uri.aspx at "International Resource Identifier Support") but the solution is not working for me. My current app.config file looks something like this: <configuration> <configSections> <sectionGroup name=

Ruby convert IDN domain from Punycode to Unicode

懵懂的女人 提交于 2019-12-30 06:33:26
问题 I'm writing a Rails app that needs to convert an IDN domain name from Punycode into its Unicode equivalent. I tried installing the idn gem that has bindings to GNU LibIDN, but it won't compile the native code. Apparently others have the same issue with Ruby 1.9.x. I also tried the pure Ruby SimpleIDN gem, but I would prefer something native. 回答1: Try the simpleidn gem. It works with Ruby 1.8.7 and 1.9.2. Edit your Gemfile: gem 'simpleidn' then you can enter the command as follows: SimpleIDN

Ruby convert IDN domain from Punycode to Unicode

狂风中的少年 提交于 2019-12-30 06:33:10
问题 I'm writing a Rails app that needs to convert an IDN domain name from Punycode into its Unicode equivalent. I tried installing the idn gem that has bindings to GNU LibIDN, but it won't compile the native code. Apparently others have the same issue with Ruby 1.9.x. I also tried the pure Ruby SimpleIDN gem, but I would prefer something native. 回答1: Try the simpleidn gem. It works with Ruby 1.8.7 and 1.9.2. Edit your Gemfile: gem 'simpleidn' then you can enter the command as follows: SimpleIDN

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

How to convert IDN to ASCII?

可紊 提交于 2019-12-18 02:41:25
问题 What is the best way to convert an internationalized domain name to its ASCII-form? I want to convert Bücher.ch into xn--bcher-kva.ch by using some sort of (free) .net code. 回答1: Have a look at the GNU IDN Library - Libidn. The introduction says that C# libraries are available. 回答2: using System.Globalization; ... IdnMapping idn = new IdnMapping(); MessageBox.Show(idn.GetAscii("www.kraków.pl")); 回答3: To Get the other way around from xn--bcher-kva.ch domain to Bücher.ch using System

preg_match verification of non English email addresses (international domain names)

ぐ巨炮叔叔 提交于 2019-12-12 06:26:32
问题 We all know email address verification is a touchy subject, there are so many opinions on the best way to deal with it without encoding for the entire RFC. But since 2009 its become even more difficult and I haven't really seen anyone address the issue of IDN's yet. Here is what I've been using: preg_match(/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,6}\z/i) Which will work for most email addresses but what if I need to match a non Latin email address? e.g.: bob@china.中國, or bob@russia.рф Look here