danielr 16 years ago
parent 4f996a7651
commit cd8082b4e3

@ -24,6 +24,7 @@
package de.anomic.http;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -129,10 +130,14 @@ public class httpResponseHeader extends httpHeader {
charSetName = DEFAULT_CHARSET;
}
// maybe the charset is valid but not installed on this computer
if(!Charset.isSupported(charSetName)) {
serverLog.logWarning("httpHeader", "charset '"+ charSetName +"' is not supported on this machine, using default ("+ Charset.defaultCharset().name() +")");
// use system default
return Charset.defaultCharset();
try {
if(!Charset.isSupported(charSetName)) {
serverLog.logWarning("httpHeader", "charset '"+ charSetName +"' is not supported on this machine, using default ("+ Charset.defaultCharset().name() +")");
// use system default
return Charset.defaultCharset();
}
} catch(IllegalCharsetNameException e) {
serverLog.logSevere("httpHeader", "Charset in header is illegal: '"+ charSetName +"'\n "+ toString());
}
return Charset.forName(charSetName);
}

Loading…
Cancel
Save