New submission from Nikita Velykanov <nvelyka...@jerasoft.net>: Let's consider there is an email box with password which contains Cyrillic symbols. When loging in
imaplib.IMAP4_SSL(host, port).login(login, password) password field is passed as "кириллица" (type is str, not unicode). Then, I get this traceback: File "/usr/lib64/python2.7/imaplib.py", line 518, in login typ, dat = self._simple_command('LOGIN', user, self._quote(password)) File "/usr/lib64/python2.7/imaplib.py", line 1083, in _simple_command return self._command_complete(name, self._command(name, *args)) File "/usr/lib64/python2.7/imaplib.py", line 870, in _command self.send('%s%s' % (data, CRLF)) File "/usr/lib64/python2.7/imaplib.py", line 1191, in send sent = self.sslobj.write(data) File "/usr/lib64/python2.7/ssl.py", line 669, in write return self._sslobj.write(data) This is because self._sslobj.write method requires unicode string. In other case, if password field is passed as u"кириллица" (type unicode, not str), I get another traceback: File "/usr/lib64/python2.7/imaplib.py", line 518, in login typ, dat = self._simple_command('LOGIN', user, self._quote(password)) File "/usr/lib64/python2.7/imaplib.py", line 1083, in _simple_command return self._command_complete(name, self._command(name, *args)) File "/usr/lib64/python2.7/imaplib.py", line 852, in _command data = '%s %s' % (data, self._checkquote(arg)) It's because '%s' % u"some unicode string" doesn't work. I guess the problem was described in details. The problem is that two different libraries are using different string types but they must be agreed. ---------- components: Library (Lib), Unicode messages: 324586 nosy: Nikita Velykanov, ezio.melotti, vstinner priority: normal severity: normal status: open title: imaplib Cyrillic password type: behavior versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34577> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com