I encounter a problem establishing a connection with an server that has some accents (é è ô…) in its hostname.
For example :
String oUrl = "www.hôtel.fr";
System.out.println(oUrl);
InetSocketAddress isa = new InetSocketAddress(oUrl.toString(), 80);
System.out.println(isa.isUnresolved());
The ISA is never resolved. It works for http://www.google.fr.
I tried to URLEncode the host (URLEncoder with UTF-8 charset, so hostname is http://www.h%C3%B4tel.fr) with no result.
Does anybody have some clues ? I don’t find anything on the web.
Thanks and sorry for my english.
In domain names, umlauts, accents, etc must be converted by punycode. In your example it would end up in
http://www.xn--htel-vqa.fr/. Without having it tested, the IDN class might be of help.