From 9cef773c96f48f31d0c021578ab9bc47e9b3acdc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 20 Nov 2014 02:21:11 +0100 Subject: Use utils encode/decode --- pyload/utils/JsEngine.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'pyload/utils/JsEngine.py') diff --git a/pyload/utils/JsEngine.py b/pyload/utils/JsEngine.py index ac3a7a7a9..f6f28f457 100644 --- a/pyload/utils/JsEngine.py +++ b/pyload/utils/JsEngine.py @@ -6,7 +6,7 @@ import sys from os import path from urllib import quote -from pyload.utils import encode, uniqify +from pyload.utils import encode, decode, uniqify class JsEngine: @@ -214,7 +214,11 @@ class RhinoEngine(AbstractEngine): def eval(self, script): script = "print(eval(unescape('%s')))" % quote(script) args = ["java", "-cp", self.path, "org.mozilla.javascript.tools.shell.Main", "-e", script] - return self._eval(args).decode("utf-8").encode("ISO-8859-1") + res = decode(self._eval(args)) + try: + return res.encode("ISO-8859-1") + finally: + return res class JscEngine(AbstractEngine): -- cgit v1.2.3