Table of Contents

Python locale problem

If you get this error or smth similar: UnicodeEncodeError: 'ascii' codec can't encode character '\u010c' in position 61: ordinal not in range(128)

Make sure the server has the locale set up correctly, usually it is enough to uncomment (en_US.UTF-8 UTF-8 and/or hr_HR.UTF-8 UTF-8):

vi /etc/locale.gen

Then run

locale-gen
locale

To verify what python sees enter python3 prompt:

python3
import sys
print(sys.getfilesystemencoding())

Should print “utf-8” not “ascii”.

Tested on

See also

References