Commits

Jakub Wilk committed 396da3a

Use ELinks-like encoding error handler if available.

  • Participants
  • Parent commits f9d099c

Comments (0)

Files changed (1)

 from xdg import BaseDirectory as xdg
 import debianbts
 
+try:
+    import elinks
+    encoding_error_handler = 'elinks'
+except ImportError:
+    encoding_error_handler = 'replace'
+
 encoding = locale.getpreferredencoding()
 
 class file_lock(object):
                     if match is not None:
                         submitter_email = match.group(1)
                     if submitter_email != email:
-                        print 'Submitter: %s' % bug.originator.encode(encoding, 'replace')
-                print 'Subject: %s' % bug.subject.encode(encoding, 'replace')
+                        print 'Submitter: %s' % bug.originator.encode(encoding, encoding_error_handler)
+                print 'Subject: %s' % bug.subject.encode(encoding, encoding_error_handler)
                 print 'Date: %s' % bug.log_modified
                 print 'Location: http://bugs.debian.org/%d' % no
                 print