diff options
Diffstat (limited to 'pyload/utils/JsEngine.py')
-rw-r--r-- | pyload/utils/JsEngine.py | 8 |
1 files changed, 6 insertions, 2 deletions
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): |