yukuku / telebot

Telegram Bot starter kit. Very easy to install with Google App Engine.
Apache License 2.0
689 stars 236 forks source link

reply('\r\n') #14

Closed aferende closed 9 years ago

aferende commented 9 years ago

Hello, if I try to send a CR+LF using replay ... it say HTTP 400, bad request.

Any help will be appreciated. Ty.

bostrot commented 9 years ago

I don't exactly know what you mean...

aferende commented 9 years ago

replay('\r\n') .... just give error ! Ty

bostrot commented 9 years ago

ok then pls send your code thanks.

aferende commented 9 years ago

the code is this:

reply('\r\n')

it gives error about encoding

ADTC commented 9 years ago

Telegram does not accept empty strings. Just a bunch of new line characters will resolve to an empty string.

Anyway paste the exact error shown.

aferende commented 9 years ago

This is the exact error code:

'ascii' codec can't decode byte 0xc3 in position 24: ordinal not in range(128) Traceback (most recent call last): File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in call rv = self.handle_exception(request, response, e) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in call rv = self.router.dispatch(request, response) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher return route.handler_adapter(request, response) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in call return handler.dispatch() File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch return self.handle_exception(e, self.app.debug) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch return method(_args, *_kwargs) File "/base/data/home/apps/e~afebot-telegram/1.386213561127088576/main.py", line 315, in post write('riga 1\r\nriga 2\r\nriga 3\r\nàèìòù') File "/base/data/home/apps/e~afebot-telegram/1.386213561127088576/main.py", line 90, in write 'text': msg.encode('utf-8'), UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 24: ordinal not in range(128)

TY

aferende commented 9 years ago

àèìòù ... seems responsabile of the error. \r\n now works fine (sure before won't work)

Ty for your work.

ADTC commented 9 years ago

See #11

aferende commented 9 years ago

Oh ... great ! Now works fine. Ty again.