Chris
Chris

Reputation: 12282

HttpClient not working with international domain name

when I try to use the System.Net.Http.HttpClient to get a response from a domain that has utf characters I get an exception.

The remote name could not be resolved

Does anyone know how to work around that or if there's a library that handles that correctly?

Upvotes: 2

Views: 364

Answers (2)

Cory Nelson
Cory Nelson

Reputation: 30001

You need to enable IDN parsing in your app.config. It is off by default.

<configuration>
  <uri>
    <idn enabled="All" />
    <iriParsing enabled="true" />
  </uri>
</configuration>

Upvotes: 1

Florian F.
Florian F.

Reputation: 4700

I don't think HttpClient does international domain name resolving.

You could implement it yourself following what is said here

You can also check what chrome does when you ask for http://Bücher.ch/

enter image description here

And you can even notice what happens when you try to copy/paste from URL field, it transforms it automatically to http://xn--bcher-kva.ch/

Upvotes: 1

Related Questions