diff options
| author | Fulgen301 <tokmajigeorge@gmailc.om> | 2017-03-16 18:59:21 +0100 |
|---|---|---|
| committer | Fulgen301 <tokmajigeorge@gmail.com> | 2017-07-11 11:10:30 +0200 |
| commit | fd0d5640e25017cc8b4ebcd6dbc084527b233334 (patch) | |
| tree | d8081a352faca1387472d4eb9657c019ac4145a2 | |
| parent | ee160e0f3c577bed459739ea1f89d83cc3e43cb9 (diff) | |
| download | pycrctrl-fd0d5640e25017cc8b4ebcd6dbc084527b233334.tar.gz pycrctrl-fd0d5640e25017cc8b4ebcd6dbc084527b233334.zip | |
Convert encode - calls to QCodec calls
| -rw-r--r-- | pycrctrl.py | 10 |
1 files 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") |
