|
|
@ -437,14 +437,18 @@ public final class httpHeader extends TreeMap implements Map {
|
|
|
|
return extractCharsetFromMimetyeHeader(mimeType);
|
|
|
|
return extractCharsetFromMimetyeHeader(mimeType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static String extractCharsetFromMimetyeHeader(String mimeType) {
|
|
|
|
public static String extractCharsetFromMimetyeHeader(String mimeType) {
|
|
|
|
int idx = mimeType.indexOf(";");
|
|
|
|
if (mimeType == null) return null;
|
|
|
|
if (idx == -1) return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String encoding = mimeType.substring(idx + 1).trim();
|
|
|
|
String[] parts = mimeType.split(";");
|
|
|
|
if (!encoding.startsWith("charset=")) return null;
|
|
|
|
if (parts == null || parts.length <= 1) return null;
|
|
|
|
|
|
|
|
|
|
|
|
return encoding.substring("charset=".length()).trim();
|
|
|
|
for (int i=1; i < parts.length; i++) {
|
|
|
|
|
|
|
|
String param = parts[i].trim();
|
|
|
|
|
|
|
|
if (param.startsWith("charset=")) return param.substring("charset=".length()).trim();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Date date() {
|
|
|
|
public Date date() {
|
|
|
|