summaryrefslogtreecommitdiffstats
path: root/module/common/JsEngine.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-10-10 14:41:21 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-10-10 14:41:21 +0200
commitd9bb618c7fc6d64610b7700f4a33ec6d0074689c (patch)
tree92253ea8007ad897dc6444afc2568f4d02380d9b /module/common/JsEngine.py
parentjs engine debug option, encode scripts before evaluating (diff)
downloadpyload-d9bb618c7fc6d64610b7700f4a33ec6d0074689c.tar.xz
rhino encoding fix
Diffstat (limited to 'module/common/JsEngine.py')
-rw-r--r--module/common/JsEngine.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/module/common/JsEngine.py b/module/common/JsEngine.py
index 427bab9d4..529f55653 100644
--- a/module/common/JsEngine.py
+++ b/module/common/JsEngine.py
@@ -24,7 +24,7 @@ from urllib import quote
ENGINE = ""
-DEBUG = False
+DEBUG = True
JS = False
PYV8 = False
RHINO = False
@@ -122,10 +122,13 @@ class JsEngine():
print "Rhino:", res
results.append(res)
+ warning = False
for x in results:
for y in results:
if x != y:
- print "### WARNING ###: Different results"
+ warning = True
+
+ if warning: print "### WARNING ###: Different results"
return results[0]
@@ -147,7 +150,7 @@ class JsEngine():
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=-1)
out, err = p.communicate()
res = out.strip()
- return res
+ return res.decode("utf8").encode("ISO-8859-1")
def error(self):
return _("No js engine detected, please install either Spidermonkey, ossp-js, pyv8 or rhino")
@@ -155,5 +158,5 @@ class JsEngine():
if __name__ == "__main__":
js = JsEngine()
- test = '"a"+"b"'
+ test = u'"ü"+"ä"'
js.eval(test) \ No newline at end of file