I
I
imambek2020-04-02 16:40:42
MySQL
imambek, 2020-04-02 16:40:42

How to send a query containing Russian letters pymysql?

It is not possible to send a request in which there are Russian letters.
If you run it in PyCharm, then everything works, if you try it through the console, it gives an error5e85eb3360b78577546289.png
5e85eb4bc6045027140391.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Pankov, 2020-04-02
@trapwalker

1. Use the third python already.
2. Use utf-8 in code.
3. If you're really impatient, use Unicode strings.
4. Do not use Windows.
There is still a zoo of cp866 , cs1251 and utf-8 in consoles, shell scripts and everywhere... target encoding.
From what and to what encoding - read in the parameters of the input / output stream. If not listed, try to distinguish whether the stream is associated with a file or with a terminal. You can write any encoding to the file, the main thing is to convert it correctly and not mix it. You need to write to the terminal either in unicode (if the encoding is specified in the stream parameters, then the python itself will convert), or in the target encoding, which can be configured / guessed, assumed and selected from several attempts.
But it's best to use the third python. There, with Unicode, everything is much simpler and more unambiguous than in the second.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question