Open
Description
Bug report
When trying to login on an imap server thant handles utf8 with an utf8 password, I get an UnicodeEncodeError: 'ascii' codec can't encode character
error.
import imaplib
import getpass
host = input('Host: ')
with imaplib.IMAP4_SSL(host) as imap:
imap.login(input('User: '), getpass.getpass())
I can't enable UTF8 before login as I end up with imaplib.IMAP4.error: command ENABLE illegal in state NONAUTH, only allowed in states AUTH
However things are OK if I add the ENABLE
command in NONAUTH
state with imaplib.Commands['ENABLE'] = ('NONAUTH', 'AUTH', )
Your environment
- CPython versions tested on: 3.10.4
- Operating system and architecture: Linux 5.16.0-4-amd64 Debian testing 5.16.12-1