Configuration uri idn values are inverted
- Dominant language
- No language data
- Stars
- 4.8k
- Forks
- 6.1k
- Avg merge
- 19h 10m
- Merged PRs (30d)
- 268
Description
Documentation says that "idn enabled = All. This value will convert any Unicode domain names to their Punycode equivalents (IDN names).", and "idn enabled = None. This value will not convert any Unicode domain names to use Punycode. This is the default value which is consistent with the .NET Framework 2.0 behavior."
However, tests seem to return the exact opposite.
Code:
```
using System;
using System.Configuration;
namespace punycodebug
{
internal class Program
{
static void Main(string[] args)
{
UriSection y = (UriSection)ConfigurationManager.GetSection("uri");
var idnStatus = y.Idn.Enabled;
string[] inputArray = new string[] { "http://www.bücher.de", "http://www.xn--bcher-kva.de" };
foreach (string url in inputArray)
{
Uri uri = new Uri(url);
string output = $"UriSection.idn.Enabled: {idnStatus} - Host: {uri.Host} - DnsSafeHost: {uri.DnsSafeHost} - IdnHost: {uri.IdnHost}";
Console.WriteLine(output);
}
}
}
}
```
**Scenario 1:**
App.Config:
```
```
Output:
```
UriSection.idn.Enabled: None - Host: www.bücher.de - DnsSafeHost: www.bücher.de - IdnHost: www.xn--bcher-kva.de
UriSection.idn.Enabled: None - Host: www.xn--bcher-kva.de - DnsSafeHost: www.xn--bcher-kva.de - IdnHost: www.xn--bcher-kva.de
```
**Scenario 2:**
App.config:
```
```
Output:
```
UriSection.idn.Enabled: All - Host: www.bücher.de - DnsSafeHost: www.xn--bcher-kva.de - IdnHost: www.xn--bcher-kva.de
UriSection.idn.Enabled: All - Host: www.bücher.de - DnsSafeHost: www.xn--bcher-kva.de - IdnHost: www.xn--bcher-kva.de
```
---
#### Document Details
⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*
* ID: 5964b70f-674f-f9fd-7c28-a108dc27b365
* Version Independent ID: d4e83b90-91e8-c7fa-1ff2-fbf414f7781c
* Content: [<idn> Element (Uri Settings) - .NET Framework](https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/network/idn-element-uri-settings)
* Content Source: [docs/framework/configure-apps/file-schema/network/idn-element-uri-settings.md](https://github.com/dotnet/docs/blob/main/docs/framework/configure-apps/file-schema/network/idn-element-uri-settings.md)
* Product: **dotnet-framework**
* Technology: **dotnet-networking**
* GitHub Login: @karelz
* Microsoft Alias: **ncldev**
Contributor guide
Assessment
This issue has not been assessed yet.