private static String getCharacterEncoding(URLConnection urlConnection) { final ParsedContentType pct = new ParsedContentType( urlConnection.getContentType()); final String encoding = pct.getEncoding(); if(encoding != null) { return encoding; } final String contentType = pct.getContentType(); if(contentType != null && contentType.startsWith("text/")) { return "8859_1"; } else { return "utf-8"; } }
private static String getCharacterEncoding(URLConnection urlConnection) { final ParsedContentType pct = new ParsedContentType( urlConnection.getContentType()); final String encoding = pct.getEncoding(); if(encoding != null) { return encoding; } final String contentType = pct.getContentType(); if(contentType != null && contentType.startsWith("text/")) { return "8859_1"; } else { return "utf-8"; } }
private static String getCharacterEncoding(URLConnection urlConnection) { final ParsedContentType pct = new ParsedContentType( urlConnection.getContentType()); final String encoding = pct.getEncoding(); if(encoding != null) { return encoding; } final String contentType = pct.getContentType(); if(contentType != null && contentType.startsWith("text/")) { return "8859_1"; } else { return "utf-8"; } }
private static String getCharacterEncoding(URLConnection urlConnection) { final ParsedContentType pct = new ParsedContentType( urlConnection.getContentType()); final String encoding = pct.getEncoding(); if(encoding != null) { return encoding; } final String contentType = pct.getContentType(); if(contentType != null && contentType.startsWith("text/")) { return "8859_1"; } else { return "utf-8"; } }
is = uc.getInputStream(); if(convertToString) { ParsedContentType pct = new ParsedContentType(uc.getContentType()); contentType = pct.getContentType(); encoding = pct.getEncoding();