Skip to content

Could not send file with Chinese character #1202

@mengyyy

Description

@mengyyy

Steps to reproduce

  1. generate a new text file and rename like 测试.txt and copy as 111.txt

  2. just send this two file
    import telegram
    TGBot = telegram.Bot(TGBotToken)
    TGBot.sendDocument(test_chatid, document=open('测试.txt', 'rb'))
    TGBot.sendDocument(test_chatid, document=open('111.txt', 'rb'))

Expected behaviour

in the elder version (10.1.0) send file with Chinese charscter is success

Actual behaviour

/usr/local/lib/python3.5/dist-packages/telegram/bot.py in decorator(self, *args, **kwargs)
63 def decorator(self, *args, **kwargs):
64 logger.debug('Entering: %s', func.name)
---> 65 result = func(self, *args, **kwargs)
66 logger.debug(result)
67 logger.debug('Exiting: %s', func.name)

/usr/local/lib/python3.5/dist-packages/telegram/bot.py in decorator(self, *args, **kwargs)
88 data['reply_markup'] = reply_markup
89
---> 90 result = self._request.post(url, data, timeout=kwargs.get('timeout'))
91
92 if result is True:

/usr/local/lib/python3.5/dist-packages/telegram/utils/request.py in post(self, url, data, timeout)
303 # Use multipart upload if we're uploading files, otherwise use JSON
304 if files:
--> 305 result = self._request_wrapper('POST', url, fields=data, **urlopen_kwargs)
306 else:
307 result = self._request_wrapper('POST', url,

/usr/local/lib/python3.5/dist-packages/telegram/utils/request.py in _request_wrapper(self, *args, **kwargs)
221 raise Unauthorized(message)
222 elif resp.status == 400:
--> 223 raise BadRequest(message)
224 elif resp.status == 404:
225 raise InvalidToken()

BadRequest: Wrong remote file id specified: wrong character in the string

Configuration

Ubuntu 16.04
Python 3.5.2
two version are both failed
python-telegram-bot==11.0.0
python-telegram-bot==11.1.0

Logs

Insert logs here (if necessary)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions