1
0
Fork 0

Fix using default encoding

This commit is contained in:
hpi1 2019-02-24 19:21:01 +02:00
parent 7f43713587
commit 2b0b711a70
1 changed files with 10 additions and 4 deletions

View File

@ -30,8 +30,12 @@ public class Logger {
// capture stdout and stderr from on-disc applets
// (those produce useful debug information sometimes)
System.setOut(createCapture(System.out, false));
System.setErr(createCapture(System.err, true));
try {
System.setOut(createCapture(System.out, false));
System.setErr(createCapture(System.err, true));
} catch (java.io.UnsupportedEncodingException uee) {
System.err.println("Error capturing stdout/stderr: " + uee);
}
prop = System.getProperty("debug.unimplemented.throw");
if (prop != null && prop.equalsIgnoreCase("YES")) {
@ -73,8 +77,10 @@ public class Logger {
return new Location();
}
private static PrintStream createCapture(final PrintStream printStream, final boolean error) {
return new PrintStream(printStream) {
private static PrintStream createCapture(final PrintStream printStream, final boolean error)
throws java.io.UnsupportedEncodingException {
return new PrintStream(printStream, false, "UTF-8") {
public void print(final String string) {
Logger.log(error, string);
}