From fd0d5640e25017cc8b4ebcd6dbc084527b233334 Mon Sep 17 00:00:00 2001 From: Fulgen301 Date: Thu, 16 Mar 2017 18:59:21 +0100 Subject: Convert encode - calls to QCodec calls --- pycrctrl.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pycrctrl.py b/pycrctrl.py index c54d147..4b87516 100644 --- a/pycrctrl.py +++ b/pycrctrl.py @@ -330,7 +330,7 @@ class PyCRCtrl(object): return (CmdResult.SyntaxFail, "Bitte gib einen Szenarionamen an!") if type(scenario) in [bytes, QByteArray]: try: - scenario = scenario.decode("utf-8") + scenario = self.codec.toUnicode(scenario) except: return (CmdResult.SyntaxFail, "Unbekannter Datentyp!") @@ -391,7 +391,7 @@ class PyCRCtrl(object): try: output = self.clonk.stdout.readline() - if bool(re.match(self.decodeRegExp(self.config.get("RegExps")["shutdownExp"]), output.decode("utf-8"))): + if bool(re.match(self.decodeRegExp(self.config.get("RegExps")["shutdownExp"]), self.codec.toUnicode(output))): self.clonk.stdin.close() elif output == b"" and self.clonk.poll() is not None: if self.clonk: @@ -401,8 +401,8 @@ class PyCRCtrl(object): return elif output: - #output = self.codec.toUnicode(output).splitlines()[0] - output = output.decode("utf-8").splitlines()[0] + output = self.codec.toUnicode(output).splitlines()[0] + #output = output.decode("utf-8").splitlines()[0] output = output[(output.find("] ") if output.find("] ") != -1 else -2)+len("] "):] if output[0] == ">": @@ -471,7 +471,7 @@ class PyCRCtrl(object): return (CmdResult.RuntimeError, "") elif type(text) not in [bytes, QByteArray]: try: - text = text.encode("utf-8") + text = self.codec.toUnicode(text) except: raise IOError("Cannot write anything else to the server except the following data types: QString, bytes, str, QByteArray") -- cgit v1.2.3-54-g00ecf