I can't seem to get the unicode representation of utf-8 characters on a production server, although it works well the development workstation.
When I use Python 3.6.9 [GCC 8.3.0] on linux (Ubuntu server).
>>> str('\u0394')
'\u0394'
>>>print('\u0394')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'latin-1' codec can't encode character '\u0394' in position 0: ordinal not in range(256)
When I use Python 3.6.5 [GCC 4.2.1] on darwin (Mac OS)
>>> str('\u0394')
'Δ'
>>> print('\u0394')
Δ
By the look of it, I'd say that there is something broken on the ubuntu server as str()
is suppose to convert to unicode in Python 3. However, it could well be that things work differently in revision 3.6.9 w.r.t. 3.6.5. Any tips on how could I get to the bottom of this?