I seem to be unable to establish a connection to an URL with Java开发者_开发百科 that contains an umlaut.
This is the url I'm trying to access: http://hakkon-aetterni.at/images/Mitglieder/Höttur.jpg
This is my Java code:
URL newLinkURL = new URL(newLink);
URLConnection uc = newLinkURL.openConnection();
String curFileContentType = uc.getContentType();
newLink url is A String containing the URL mentioned above. When trying to connect to this url i get a 500 Error in response.
You should encode part of the URL to something like this: http://hakkon-aetterni.at/images/Mitglieder/H%C3%B6ttur.jpg
URL class doesn't encodes passed parameter itself.
http://download.oracle.com/javase/6/docs/api/java/net/URLEncoder.html
精彩评论