Labels

Tuesday, September 11, 2007

MSDN Magzine - Orcas - IRI Support

Uniform Resource Identifiers (URIs) :

· Web addresses are typically expressed using

· URI's consist of a very restricted set of characters. English alphabet[Lower/Upper], digits [0-9], and ASCII symbols including commas and hyphens.

But what for a character set other than a Latin alphabet—say, Japanese or Hebrew.

International Resource Identifiers (or IRIs)

· Support non-ASCII characters—or more precisely Unicode/ISO 10646 characters.

· This means a domain name can contain Unicode characters, which means you can end up with a URL that looks like this: http://微軟香港.com.

.Net Framework 3.5 [Orcas] –

· Orcas has extended the existing System.Uri class to provide IRI support based on RFC 3987 (see faqs.org/rfcs/rfc3987.html).

· But still the current users will not see any change from the .NET Framework 2.0 behavior unless they specifically opt for IRI capabilities to be enabled.

· The reason for this is to ensure application compatibility between the 3.5 release and prior versions.

To opt in, you need to make two changes.

1. First, add the following element to the machine.config file:

<section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

 

2. Then specify whether Internationalized Domain Name (IDN) parsing should be applied to the domain name and whether IRI parsing rules should be applied. This can be done in the machine-wide machine.config or in an individual application's app.config. For example:

 

<configuration>

<uri>

<idn enabled="All" />

<iriParsing enabled="true" />

</uri>

</configuration>

 

· Enabling IDN will convert all Unicode labels in a domain name to their Punicode equivalents.

· Punicode names contain only ASCII characters and always start with the prefix "xn--". This is because most DNS servers currently deployed on the Internet only support ASCII characters. Enabling IDN only affects the value of the Uri.DnsSafeHost property.

· For 微軟香港.com, it will contain xn--g5tu63aivy37i.com, while Uri.Host will contain the Unicode characters.

There are three possible values for IDN you can use in the idn element's enabled attribute depending on the DNS servers you're using:

· "All" will use IDN names (Punicode) for all domains.

· "AllExceptIntranet" will use IDN names for all external domains and Unicode names for all internal domains. This case only applies when the intranet DNS servers support Unicode names.

· "None", which is the default, is consistent with the .NET Framework 2.0 behavior.

To learn more about the uniform resource identifiers and the Uri class, see the online documentation at msdn2.microsoft.com/system.uri.

Thanks & Regards,

Arun Manglick || Tech Lead

No comments:

Post a Comment