Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

import java.util.concurrent.TimeUnit;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down Expand Up @@ -52,7 +54,7 @@ public int run(ScriptConfig.BoundCommand command, JobControl jobControl) {
return -2;
}

stdinWriter = new BufferedWriter(new OutputStreamWriter(process.getOutputStream()));
stdinWriter = new BufferedWriter(new OutputStreamWriter(process.getOutputStream(), StandardCharsets.UTF_8));

var stdoutThread =
new Thread(this::processStdout, Thread.currentThread().getName() + "-stdout");
Expand Down Expand Up @@ -82,7 +84,7 @@ public int run(ScriptConfig.BoundCommand command, JobControl jobControl) {
}

private void processStdout() {
try (var stdoutReader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
try (var stdoutReader = new BufferedReader(new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8))) {
String line;
while ((line = stdoutReader.readLine()) != null) {
jobControl.yield();
Expand All @@ -101,7 +103,7 @@ private void processStdout() {
}

private void processStderr() {
try (var stderrReader = new BufferedReader(new InputStreamReader(process.getErrorStream()))) {
try (var stderrReader = new BufferedReader(new InputStreamReader(process.getErrorStream(), StandardCharsets.UTF_8))) {
String line;
while ((line = stderrReader.readLine()) != null) {
jobControl.yield();
Expand Down
4 changes: 4 additions & 0 deletions common/src/main/resources/system/lib/minescript_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@
import time
import threading
import traceback
import io

from dataclasses import dataclass
from typing import Any, List, Set, Dict, Tuple, Optional, Callable

if sys.stdin.encoding != 'utf-8':
sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8', errors='replace')

AnyConsumer = Callable[[str], None]
ExceptionHandler = Callable[[Exception], None]

Expand Down