A
A
a2020-05-28 21:14:33
Python
a, 2020-05-28 21:14:33

How to fix encoding error?

Uploaded python code to VPS Ubuntu 18.04 LTS. After starting the error

Traceback (most recent call last):
  File "main.py", line 12, in <module>
    print("\u0411\u043e\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d")
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)


It works locally, how can I fix it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
a, 2020-05-29
@MZOK

Fixed the error by running the command
export PYTHONIOENCODING=utf-8

T
tegrato, 2020-05-29
@tegrato

Wouldn't something like this help?
https://skalolaskovy.ru/python/462-python-and-cyrillic
(there, however, only about the Russian text)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question