imapbackup icon indicating copy to clipboard operation
imapbackup copied to clipboard

UnicodeEncodeError: 'ascii' codec can't encode character '\xa3'

Open DustyArmstrong opened this issue 2 years ago • 1 comments

Hi there,

Ran across an issue with certain language characters in the password, specifically "£" in this case.

Password:
Connecting to 'imap.test.com' TCP port 143
Logging in as '[email protected]'
Traceback (most recent call last):
  File "/home/suders/imapbackup/imapbackup38.py", line 793, in <module>
    main()
  File "/home/suders/imapbackup/imapbackup38.py", line 671, in main
    server = connect_and_login(config)
  File "/home/suders/imapbackup/imapbackup38.py", line 615, in connect_and_login
    server.login(config['user'], config['pass'])
  File "/usr/lib/python3.9/imaplib.py", line 610, in login
    typ, dat = self._simple_command('LOGIN', user, self._quote(password))
  File "/usr/lib/python3.9/imaplib.py", line 1230, in _simple_command
    return self._command_complete(name, self._command(name, *args))
  File "/usr/lib/python3.9/imaplib.py", line 987, in _command
    arg = bytes(arg, self._encoding)
UnicodeEncodeError: 'ascii' codec can't encode character '\xa3' in position 12: ordinal not in range(128)

Unsure how to fix, seems to be an issue with imaplib and what it is being passed. Research suggests that it may be that imaplib is expecting a series of UTF-8 bytes instead of a raw unicode string, but I'm far from knowledgeable on this.

DustyArmstrong avatar Jul 25 '22 17:07 DustyArmstrong

This only seems to be an issue with imapbackup38.py, the Python 2 one works fine.

DustyArmstrong avatar Jul 25 '22 17:07 DustyArmstrong

This issue is stale because it has been open for 90 days with no activity.

github-actions[bot] avatar Oct 24 '22 02:10 github-actions[bot]

This issue was closed because it has been inactive for 30 days since being marked as stale.

github-actions[bot] avatar Nov 24 '22 02:11 github-actions[bot]