feed-pqm aborts if proposal includes unmappable character

Bug #612641 reported by John A Meinel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Hydrazine
In Progress
Medium
Unassigned

Bug Description

I guess someone put a non-ascii character into either the status comment, or the commit message, which cannot be displayed on my system. I got a traceback and it killed the process, so I can't use feed-pqm until this gets cleared out.

Traceback (most recent call last):
  File "C:/Users/jameinel/dev/bzr/other/hydrazine/feed-pqm", line 226, in <module>
    sys.exit(main(sys.argv))
  File "C:/Users/jameinel/dev/bzr/other/hydrazine/feed-pqm", line 186, in main
    show_mp(mp)
  File "C:/Users/jameinel/dev/bzr/other/hydrazine/feed-pqm", line 105, in show_mp
    print "%s: %s" % (comment.author.name, comment.message_body)
  File "C:\Python26\lib\encodings\cp437.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u201c' in position 571: character maps
 to <undefined>

Related branches

John A Meinel (jameinel)
Changed in hydrazine:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
John A Meinel (jameinel) wrote :

This is my 'trivial' fix for it:

=== modified file 'feed-pqm'
--- feed-pqm 2010-06-28 19:13:18 +0000
+++ feed-pqm 2010-10-01 20:59:46 +0000
@@ -102,7 +102,12 @@
     print "Recent comments:"
     comments = list(mp.all_comments) #XXX: See bug lp:583761
     for comment in comments[-1:]:
- print "%s: %s" % (comment.author.name, comment.message_body)
+ val = "%s: %s" % (comment.author.name, comment.message_body)
+ try:
+ print val
+ except UnicodeError:
+ val = val.encode('ascii', 'replace')
+ print val

 def set_message(mp):

Martin Pool (mbp)
Changed in hydrazine:
status: Confirmed → In Progress
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.