Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128) #483

micahflee opened this Issue Mar 3, 2014 · 4 comments


None yet
3 participants

I'm trying to get Mailpile up and working. I've followed the Linux instructions using offlineimap. But when I run ./mp and and type rescan I get this python error:

mailpile> rescan                                                               

Note: periodic delay is 0.02s, run from shell to speed up: mp --rescan=...     
Traceback (most recent call last):
  File "/home/micah/projects/Mailpile/mailpile/commands.py", line 248, in _run
    return self._finishing(command, command(self, *args, **kwargs))
  File "/home/micah/projects/Mailpile/mailpile/commands.py", line 245, in command
    return self.command(*args, **kwargs)
  File "/home/micah/projects/Mailpile/mailpile/commands.py", line 682, in command
    self._rescan_vcards(session, config),
  File "/home/micah/projects/Mailpile/mailpile/commands.py", line 696, in _rescan_vcards
    imported += imp.import_vcards(session, config.vcards)
  File "/home/micah/projects/Mailpile/mailpile/vcard.py", line 829, in import_vcards
    all_vcards = self.get_vcards()
  File "/home/micah/projects/Mailpile/mailpile/plugins/vcard_gnupg.py", line 39, in get_vcards
    vcls.append(VCardLine(name="email", value=uid["email"]))
  File "/home/micah/projects/Mailpile/mailpile/vcard.py", line 59, in __init__
    self._value = unicode(value)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)

Failed: rescan                                                                 

Elapsed: 0.000s (rescan({}))                                                   
Failed: Add new messages to index

@smari smari added this to the Beta milestone Mar 5, 2014


smari commented Mar 5, 2014

This bug appears to be generated by the GnuPG interface (gpgi.py) in cases where you have keys with user identities in your keyring which are encoded with something other than UTF-8 or ISO-8859-1. I'll check if there's some way to get encoding information from gnupg, but we're already using --utf-8 to try and force it to output the right stuff. Can you identify the offending characters in your keyring?

The offending key is probably one of these ASCII art keys:

[user@email ~]$ gpg --list-keys --fingerprint 038EEE9FB6CA3F134CDF714437F688B9C9A30854 612970A3801675322E99D920CC2BFB965FFDBF8A A99C6728ECF2F0E56BA2F7AB6AAF39E517A750F2 1A0CC92CFC7484DA0757CA0C7B89D323F7F253D8 876F0A6F7EFFC5BD719DAE760254364C524FB9A7 A153F5D3C4D0047FD0B78C7EDA316CA80C5A841A
pub   4096R/524FB9A7 2013-07-21
      Key fingerprint = 876F 0A6F 7EFF C5BD 719D  AE76 0254 364C 524F B9A7
uid                  ┃                      ~ Observe. Hack. Make. 2013 ~                      ┃

pub   4096R/5FFDBF8A 2013-07-21
      Key fingerprint = 6129 70A3 8016 7532 2E99  D920 CC2B FB96 5FFD BF8A
uid                  ┃ ┃ ┣┳┛┃ ┃┃  ┃  ┃┃┗┫┃╺┓    ┃ ┣━┫┣╸    ┃╻┃┣╸ ┣┻┓   ┃ ┃┣╸     ┃ ┣┳┛┃ ┃┗━┓ ┃ ┃

pub   4096R/17A750F2 2013-07-21
      Key fingerprint = A99C 6728 ECF2 F0E5 6BA2  F7AB 6AAF 39E5 17A7 50F2
uid                  ┃ ╹ ╹┗╸┗━┛┗━╸┗━╸╹╹ ╹┗━┛    ╹ ╹ ╹┗━╸   ┗┻┛┗━╸┗━┛   ┗━┛╹      ╹ ╹┗╸┗━┛┗━┛ ╹ ┃

pub   4096R/F7F253D8 2013-07-21
      Key fingerprint = 1A0C C92C FC74 84DA 0757  CA0C 7B89 D323 F7F2 53D8
uid                  ┃╺┳╸┏━┓┏━┓╻  ╻  ╻┏┓╻┏━╸   ╺┳╸╻ ╻┏━╸   ╻ ╻┏━╸┏┓    ┏━┓┏━╸   ╺┳╸┏━┓╻ ╻┏━┓╺┳╸┃

pub   4096R/C9A30854 2013-07-21
      Key fingerprint = 038E EE9F B6CA 3F13 4CDF  7144 37F6 88B9 C9A3 0854
uid                  ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓

pub   4096R/0C5A841A 2013-07-21
      Key fingerprint = A153 F5D3 C4D0 047F D0B7  8C7E DA31 6CA8 0C5A 841A
uid                  ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

But it might be one of these (which includes yours :)):

[user@email ~]$ gpg --list-keys --fingerprint 8DC901CE64146C048AD50FBB792152527B75921E 8BC7ABABC2F24D5E24FCFC1CDB0EA4BCE2107412 7670B684846EC70E61EFFB7F07AAA4D95F3D6695 B2216FD2779AE5B59D79743CD5DC2A79C2E4AE92 BF15D16FF7B83CF9BAAE784E2D7BE9DBA8B0BDD9 61DBD9A000A467CF2A90896161918FBF06A11494 ECF2DEA89EB90C612440B2B84814DEC22B307C3C 46E5EF37DE264EA68DCF53EAE3A21297150FE210 177E94D0AABDD41CA63EC1930B9D45A6A9CC81C1 30414D81DC28290C25686DE3DA4958F611E149E9
pub   4096R/7B75921E 2009-05-29 [expires: 2016-06-01]
      Key fingerprint = 8DC9 01CE 6414 6C04 8AD5  0FBB 7921 5252 7B75 921E
uid                  Antoine Beaupré <anarcat@koumbit.org>
uid                  Antoine Beaupré <anarcat@orangeseeds.org>
uid                  Antoine Beaupré (work) <anarcat@koumbit.org>
uid                  Antoine Beaupré (Debian) <anarcat@debian.org>
uid                  Antoine Beaupré (home address) <anarcat@anarcat.ath.cx>
uid                  Antoine Beaupré <anarcat@debian.org>
sub   4096R/9C5A5581 2009-05-29 [expires: 2016-06-01]
sub   2048R/D2DF2587 2012-07-18
sub   2048R/EE02855A 2012-07-20
sub   2048R/AFD0FDF8 2012-07-24

pub   3072R/E2107412 2011-08-16
      Key fingerprint = 8BC7 ABAB C2F2 4D5E 24FC  FC1C DB0E A4BC E210 7412
uid                  Dominik George (E-Mail / XMPP) <nik@naturalnet.de>
uid                  Dominik George (Fellowship of the FSFE) <nik@fsfe.org>
uid                  Dominik George (CAcert Inc.) <dominik.george@cacert.org>
uid                  Dominik George (FrOSCon e.V.) <dominik.george@froscon.org>
uid                  Dominik George (Teckids e.V.) <dominik.george@teckids.org>
uid                  Dominik George (pro parity IT-Service) <dominik.george@proparity.de>
uid                  Dominik George (Wuppertaler Linux User Group e.V.) <dominik.george@wuplug.org>
uid                  Dominik George (Bergische Universität Wuppertal) <dominik.george@uni-wuppertal.de>
uid                  Dominik George (Städt. Leibniz-Gymnasium Remscheid) <dominik.george@leibniz-remscheid.de>
uid                  [jpeg image of size 1996]
sub   3072R/D75BB677 2011-08-16
sub   3072R/3A0574EE 2012-01-15

pub   4096R/5F3D6695 2011-05-13
      Key fingerprint = 7670 B684 846E C70E 61EF  FB7F 07AA A4D9 5F3D 6695
uid                  Svavar Kjarrval Lúthersson (My full real name)
uid                  Svavar Kjarrval
uid                  Svavar Kjarrval <svavar@kjarrval.is>
uid                  Svavar Kjarrval Lúthersson <svavar@kjarrval.is>
sub   4096R/86EBDFA9 2011-05-13

pub   4096R/C2E4AE92 2010-12-30
      Key fingerprint = B221 6FD2 779A E5B5 9D79  743C D5DC 2A79 C2E4 AE92
uid                  Smári McCarthy <smari@immi.is>
sub   4096R/176BA0AC 2010-12-30

pub   4096R/A8B0BDD9 2012-02-06
      Key fingerprint = BF15 D16F F7B8 3CF9 BAAE  784E 2D7B E9DB A8B0 BDD9
uid                  Guillaume Douté (gde) <gde@cosmogol.net>
sub   4096R/438AD0E5 2012-02-06

pub   4096R/06A11494 2010-02-04 [expired: 2014-01-12]
      Key fingerprint = 61DB D9A0 00A4 67CF 2A90  8961 6191 8FBF 06A1 1494
uid                  Jérémie Courrèges-Anglas <jca@wxcvbn.org>
uid                  Jérémie Courrèges-Anglas (aka cthuluh) <ktulu@wxcvbn.org>
uid                  Jérémie Courrèges-Anglas (Université de Nantes) <jeremie.courreges-anglas@etu.univ-nantes.fr>
uid                  Jérémie Courrèges-Anglas <jca@autogeree.net>

pub   4096R/150FE210 2011-10-23 [expires: 2014-05-04]
      Key fingerprint = 46E5 EF37 DE26 4EA6 8DCF  53EA E3A2 1297 150F E210
uid                  Arturo Filastò <art@torproject.org>
uid                  Arturo Filastò <art@fuffa.org>
uid                  Arturo Filastò <art@baculo.org>
uid                  Arturo Filastò <hellais@gmail.com>
uid                  Arturo Filastò <art@globaleaks.org>
uid                  Arturo Filastò <arturo@filasto.net>
uid                  Arturo Filastò <arturo.filasto@logioshermes.org>
sub   4096R/F423B27C 2011-10-23 [expires: 2014-05-04]

pub   4096R/2B307C3C 2009-07-09 [expires: 2015-05-01]
      Key fingerprint = ECF2 DEA8 9EB9 0C61 2440  B2B8 4814 DEC2 2B30 7C3C
uid                  Jérémy Bobbio <lunar@debian.org>
uid                  Lunar <lunar@torproject.org>
uid                  Jérémy Bobbio <jeremy.bobbio@irq7.fr>
sub   4096R/306334A8 2009-07-09 [expires: 2015-05-01]

pub   2048R/A9CC81C1 2012-05-31
      Key fingerprint = 177E 94D0 AABD D41C A63E  C193 0B9D 45A6 A9CC 81C1
uid                  Oktavía Hrund Jónsdóttir <oktavia@humanlinknetwork.org>
uid                  Oktavía Jónsdóttir - IREX <ojonsdottir@irex.org>
uid                  Oktavía Hrund Jónsdóttir (Gmail - Private) <oktaviahrund@gmail.com>
uid                  Oktavía Jónsdóttir - Media Frontiers (MF email) <oj@media-frontiers.org>
uid                  Oktavia Jonsdottir - Transterra Media (Transterra Media SAL) <oktavia@transterramedia.com>
sub   2048R/ECCC1D4B 2012-05-31

pub   4096R/11E149E9 2009-08-31
      Key fingerprint = 3041 4D81 DC28 290C 2568  6DE3 DA49 58F6 11E1 49E9
uid                  Cédric Boutillier <boutil@debian.org>
uid                  Cédric Boutillier <cedric.boutillier@upmc.fr>
uid                  Cédric Boutillier <cedric.boutillier@gmail.com>
uid                  Cédric Boutillier <cedric.boutillier@polytechnique.org>
sub   4096R/639E03BE 2009-08-31
sub   4096R/8F9F8F09 2013-07-09

@BjarniRunar BjarniRunar modified the milestones: Beta, 1.0 Release Sep 11, 2014


BjarniRunar commented Jan 26, 2015

Relates to #1228


BjarniRunar commented Jun 8, 2015

I believe this was fixed in bb08e4c, please re-open or file a new issue if the problem persists. Thanks!

@BjarniRunar BjarniRunar closed this Jun 8, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment