M
M
Michael Compass2020-12-22 16:54:44
Telegram
Michael Compass, 2020-12-22 16:54:44

How to fix Cyrillic encoding in Telegram bot on Google Cloud?

I made a telegram bot, launched it on a server on Ubuntu from Google Cloud.
But the bot in Russian (Cyrillic) has encoding problems.

The bot config is saved in UTF-8, the language pack for RU is installed on the server.

5fe1f8d88a37f969967747.jpeg

There is a suspicion that the encoding in the files on the server is broken and the problem with the google cloud server is connected rather than with the bot. What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Pankov, 2020-12-22
@trapwalker

The problem is in the crooked work with the encoding in the source code of the bot.
All because of programming at random. They didn’t figure it out, they just did it to work on a home computer, but at home, probably Windows, where in the terminal 866 in the file system somewhere 1251 somewhere utf-32. When you don’t fully understand what you are doing, you somehow make copy-paste and it doesn’t know how it works ... for the time being, until the locale changes, or the default, or the file system with a different encoding does not turn up, or the locale will be indicated in the terminal another. AND EVERYTHING IS GONE! PAMAGITI! Here's some coffee grounds for you, guess what I messed up in the source code and where I'll convert the encoding through one place.
Judging by the cracks, your "experienced" programmer somewhere hardcoded the wrong conversion of utf-8 to windows 1251. Here you can understand by the determinant:
https://habr.com/ru/post/147843/
The problem is clearly in the shitty code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question