Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 70813: ordinal not in range(128) #12

Closed
timonweb opened this issue Jan 27, 2017 · 3 comments

Comments

@timonweb
Copy link

I get the error

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 70813: ordinal not in range(128)

every time I try to run any JS code via dukpy.babel_compile

Here's an example snippet:

dukpy.babel_compile("var o = {'value': 5}; o['value'] += 7; o")

Env: Python 3.4 with virtualenv

@webknjaz
Copy link
Contributor

webknjaz commented Mar 7, 2017

@timonweb try setting any UTF-8 aware locale using environment variables.

@amol-
Copy link
Owner

amol- commented Apr 9, 2018

Problem is caused by the fact that the babel compiler is UTF8 javascript, so when dukpy tries to read the compiler to run it it will receive utf8 data, but Python3.X decodes data according to the system locale.

Your system locale is probably ascii ("C"?) so Python is trying to decode the babel source code as plain ascii and failing.

I hope to fix this for next release as it's also a requirement for windows systems

@amol-
Copy link
Owner

amol- commented Apr 18, 2018

This should have been fixed in 0.2.0 release.

@amol- amol- closed this as completed Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants