* fixed possible NPE

This commit is contained in:
Reinhard Pointner 2009-10-22 12:19:22 +00:00
parent 916f168d98
commit 6f95136431
1 changed files with 7 additions and 2 deletions

View File

@ -143,10 +143,15 @@ public final class WebRequest {
Logger.getLogger(WebRequest.class.getName()).log(Level.WARNING, e.getMessage());
}
}
// use http default encoding only for text/html
if (contentType.equals("text/html")) {
return Charset.forName("ISO-8859-1");
}
}
// use http default encoding only for text/html, use UTF-8 for everything else (e.g. XML)
return Charset.forName(contentType.equals("text/html") ? "ISO-8859-1" : "UTF-8");
// use UTF-8 if we don't know any better
return Charset.forName("UTF-8");
}