diff --git a/dukpy/babel.py b/dukpy/babel.py index 03777ef..1d966c3 100644 --- a/dukpy/babel.py +++ b/dukpy/babel.py @@ -9,9 +9,9 @@ def babel_compile(source, **kwargs): presets = kwargs.get('presets') if not presets: kwargs['presets'] = ["es2015"] - with open(BABEL_COMPILER, 'r') as babel_js: + with open(BABEL_COMPILER, 'rb') as babel_js: return evaljs( - (babel_js.read(), + (babel_js.read().decode('utf-8'), 'var bres, res;' 'bres = Babel.transform(dukpy.es6code, dukpy.babel_options);', 'res = {map: bres.map, code: bres.code};'), diff --git a/dukpy/coffee.py b/dukpy/coffee.py index d9b39c6..121133a 100644 --- a/dukpy/coffee.py +++ b/dukpy/coffee.py @@ -6,9 +6,9 @@ COFFEE_COMPILER = os.path.join(os.path.dirname(__file__), 'jsmodules', 'coffeesc def coffee_compile(source): """Compiles the given ``source`` from CoffeeScript to JavaScript""" - with open(COFFEE_COMPILER, 'r') as coffeescript_js: + with open(COFFEE_COMPILER, 'rb') as coffeescript_js: return evaljs( - (coffeescript_js.read(), + (coffeescript_js.read().decode('utf-8'), 'CoffeeScript.compile(dukpy.coffeecode)'), coffeecode=source )