diff --git a/dukpy/evaljs.py b/dukpy/evaljs.py index d2d2526..3e9c498 100644 --- a/dukpy/evaljs.py +++ b/dukpy/evaljs.py @@ -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): diff --git a/tests/test_evaljs.py b/tests/test_evaljs.py index 46fc73b..36dd30f 100644 --- a/tests/test_evaljs.py +++ b/tests/test_evaljs.py @@ -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: