2

When I call IdnMapping.GetAscii(http://президент.рф/) I am getting result xn--http://-5ggibum1ewap2b.xn--/-4tbm which is not correct.

I don't know where is the problem ? Is this method works as expected in C# ? When I copy paste same url in Google Chrome which auto converts this into http://xn--d1abbgf6aiiy.xn--p1ai/

Radenko Zec
  • 7,659
  • 6
  • 35
  • 39

1 Answers1

2

Domain names do not include the protocol prefix. Remove http:// and the trailing backslash to get the exact same result.

    static void Main(string[] args) {
        var map = new System.Globalization.IdnMapping();
        Console.WriteLine(map.GetAscii("президент.рф"));
    }

Output:

xn--d1abbgf6aiiy.xn--p1ai

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536