A
A
Alex Helber2017-02-22 03:39:21
Python
Alex Helber, 2017-02-22 03:39:21

How to teach bourgeois Ubuntu great and mighty?

There is a remote AWS machine (Ubuntu Server) and there is a python script that writes (or rather does not write) Cyrillic to a file. When it comes to writing a line:

UnicodeEncodeError: 'ascii' codec can't encode characters in position 22-23: ordinal not in range(128)

I can't even read the Cyrillic alphabet on this machine:
bf4ce3fefb6b461694c0bb7942e43f12.JPG
Everything works flawlessly on Windows
def history(RUstr):
    print(RUstr)
    h = open('history.txt', 'a')
    h.write(RUstr)
    h.write('\n')
    h.close()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
planc, 2017-02-22
@planc

sudo locale-gen "ru_RU.UTF-8"
sudo dpkg-reconfigure locales

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question