Answer the question
In order to leave comments, you need to log in
How to fix 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128) error?
Hello, I'm trying to run my bot on https://www.pythonanywhere.com/
But I get this error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
Swears at this line in bothe:
bot.edit_message_text(chat_id = c.message.chat.id, message_id = c.message.message_id, text = yourorder + u'Страна: ' + district + '\n\n' + u'Выбери товар', reply_markup=key)
Answer the question
In order to leave comments, you need to log in
yourorder = yourorder.decode('utf-8') # или 'cp1251' или 'cp866' или что та у вас
district = district.decode('utf-8')
bot.edit_message_text(
chat_id=c.message.chat.id,
message_id=c.message.message_id,
text= u'{}Страна: {}\n\nВыбери товар'.format(yourorder, district),
reply_markup=key,
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question