Encode to UTF8 text messages

This commit is contained in:
Leandro Toledo 2015-07-12 10:30:35 -03:00
parent 2cee590ca8
commit 649fbc40c8
2 changed files with 7 additions and 2 deletions

View file

@ -21,7 +21,7 @@ def echo():
if LAST_UPDATE_ID < update.update_id:
# chat_id is required to reply any message
chat_id = update.message.chat_id
message = update.message.text.encode('utf-8')
message = update.message.text
if (message):
# Reply the message

View file

@ -82,6 +82,11 @@ class Message(object):
else:
reply_to_message = None
if 'text' in data:
text = data['text'].encode('utf-8')
else:
text = None
if 'audio' in data:
from telegram import Audio
audio = Audio.de_json(data['audio'])
@ -143,7 +148,7 @@ class Message(object):
forward_from=forward_from,
forward_date=data.get('forward_date', None),
reply_to_message=reply_to_message,
text=data.get('text', None),
text=text,
audio=audio,
document=document,
photo=photo,