/** Returns the charset specified in the Content-Type of this header. */ public static String getCharset(KJHttpResponse response) { Map<String, String> header = response.getHeaders(); if (header != null) { String contentType = header.get("Content-Type"); if (!TextUtils.isEmpty(contentType)) { String[] params = contentType.split(";"); for (int i = 1; i < params.length; i++) { String[] pair = params[i].trim().split("="); if (pair.length == 2) { if (pair[0].equals("charset")) { return pair[1]; } } } } } return null; }
public static String getHeader(KJHttpResponse response, String key) { return response.getHeaders().get(key); }