Commit 50ae49c0 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

Windows: Fix UTF-8 en/decode.

No related merge requests found
Pipeline #54962 passed with stages
in 3 minutes and 22 seconds
Showing with 17 additions and 11 deletions
+17 -11
...@@ -20,7 +20,7 @@ import os ...@@ -20,7 +20,7 @@ import os
import logging import logging
from datetime import datetime from datetime import datetime
from tools import timer, parse_command_line, get_version from tools import timer, parse_command_line, get_version, logger_exception
try: try:
# Installation allow Unix-like signal # Installation allow Unix-like signal
...@@ -271,12 +271,15 @@ class CommandLineSolver(AbstractSolver): ...@@ -271,12 +271,15 @@ class CommandLineSolver(AbstractSolver):
return True return True
def _data_ready(self): def _data_ready(self):
# Read process output and put lines in queue try:
s = self._process.readAll().data().decode() # Read process output and put lines in queue
s = self._process.readAll().data().decode('utf-8', "replace")
if self._output is not None:
for x in s.split('\n'): if self._output is not None:
self._output.put(x) for x in s.split('\n'):
self._output.put(x)
except Exception as e:
logger_exception(e)
def _finished(self, study, exit_code, exit_status): def _finished(self, study, exit_code, exit_status):
if self._output is not None: if self._output is not None:
......
...@@ -296,10 +296,13 @@ class SolverLogWindow(PamhyrWindow): ...@@ -296,10 +296,13 @@ class SolverLogWindow(PamhyrWindow):
while self._output.qsize() != 0: while self._output.qsize() != 0:
s = self._output.get() s = self._output.get()
if type(s) is str and "[ERROR]" in s: try:
self._log(s, color="red") if type(s) is str and "[ERROR]" in s:
else: self._log(s.encode("utf-8"), color="red")
self._log(s) else:
self._log(s)
except Exception as e:
logger_exception(e)
#################### ####################
# Process controle # # Process controle #
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment