mirror of https://github.com/amol-/dukpy.git
Fix passing unicode variables to evaljs
This commit is contained in:
parent
b2e3d95f6b
commit
e212376227
|
@ -45,7 +45,7 @@ class JSInterpreter(object):
|
|||
|
||||
Returns the last object on javascript stack.
|
||||
"""
|
||||
jsvars = json.dumps(kwargs)
|
||||
jsvars = json.dumps(kwargs, ensure_ascii=False)
|
||||
jscode = self._adapt_code(code)
|
||||
|
||||
if not isinstance(jscode, bytes):
|
||||
|
|
|
@ -29,6 +29,10 @@ class TestEvalJS(unittest.TestCase):
|
|||
s = dukpy.evaljs("dukpy.c + '華'", c="華")
|
||||
assert s == '華華'
|
||||
|
||||
def test_unicode_emoji(self):
|
||||
s = dukpy.evaljs("dukpy.c + '華'", c="🏠")
|
||||
assert s == '🏠華'
|
||||
|
||||
def test_eval_files(self):
|
||||
testfile = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'test.js')
|
||||
with open(testfile) as f:
|
||||
|
|
Loading…
Reference in New Issue