I am running into a UnicodeEncodeError
with a file that I am processing in Python. I have gone through the number of SO entries with similar errors, but none work fix my situation (or do not give sufficient detail to apply them correctly to my problem).
Upon investigating, I've nailed the issue down to the following example:
➜ python
Python 3.5.2 | packaged by conda-forge | (default, Jul 7 2016, 12:51:46)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> y = u'\xe4'
>>> print(y)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 0: ordinal not in range(128)
➜ echo $LANG
en_US.UTF-8
How might I resolve this?