-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
logging fails with unicode chars #96
Comments
A helper like this is relatively robust and fixes the problem most of the time… https://github.com/jhermann/waif/blob/master/python/to_uft8.py |
+1 |
stream seems support only ascii strings, non ascii chars can be ignored or replaced with placeholder. What do you think?
|
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Error traceback (last part):
File "/data/webadmin/.virtualenvs/ui/lib/python2.7/site-packages/nodeenv.py", line 144, in emit
self.stream.write(fs % msg)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2018' in position 42: ordinal not in range(128)
Since the encode/decode functions always confused me since I started using python, not sure what the best way would be to fix this.
What worked for me was:
self.stream.write(fs % msg.encode('utf8'))
But this will fail if msg is of type 'str'
The text was updated successfully, but these errors were encountered: