This attempts to fix the error:
"Error processing game output: 'gbk' codec can't decode byte 0xac in position 33: illegal multibyte sequence" as reported by nicotomia from the audiogames.net forum.
This commit is contained in:
parent
1a9b8d5c03
commit
6e9aaa9751
@ -225,12 +225,26 @@ class SpeechHandler:
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
line = process.stdout.readline()
|
# Read raw bytes from stdout
|
||||||
# Keep gzdoom's existing functionality of lines being printed to the console.
|
rawLine = process.stdout.buffer.readline()
|
||||||
print(line, end='')
|
if not rawLine:
|
||||||
if not line:
|
|
||||||
break
|
break
|
||||||
|
|
||||||
|
# Try different encodings
|
||||||
|
for encoding in ['utf-8', 'latin1', 'cp1252']:
|
||||||
|
try:
|
||||||
|
line = rawLine.decode(encoding)
|
||||||
|
break
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
# If all encodings fail, skip this line
|
||||||
|
print(f"Warning: Could not decode line: {rawLine}", file=sys.stderr)
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Keep gzdoom's existing functionality of lines being printed to the console
|
||||||
|
print(line, end='')
|
||||||
|
|
||||||
lineStr = line.strip()
|
lineStr = line.strip()
|
||||||
|
|
||||||
# Wait for the initial separator before starting speech
|
# Wait for the initial separator before starting speech
|
||||||
@ -245,7 +259,7 @@ class SpeechHandler:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error processing game output: {e}", file=sys.stderr)
|
print(f"Error processing game output: {e}", file=sys.stderr)
|
||||||
break
|
continue # Continue processing instead of breaking
|
||||||
|
|
||||||
|
|
||||||
class MenuDialog(QDialog):
|
class MenuDialog(QDialog):
|
||||||
@ -1675,7 +1689,6 @@ class DoomLauncher(QMainWindow):
|
|||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
bufsize=1,
|
bufsize=1,
|
||||||
text=True,
|
|
||||||
env=dict(os.environ, PYTHONUNBUFFERED="1"),
|
env=dict(os.environ, PYTHONUNBUFFERED="1"),
|
||||||
startupinfo=startupinfo
|
startupinfo=startupinfo
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user