Opened 6 years ago

Closed 6 years ago

#3199 closed bug (Fixed)

unicode crash in deluge-console

Reported by: pjlbyrne Owned by: Cas
Priority: major Milestone: 2.0.0
Component: Console UI Version: develop
Keywords: Cc:


I 'fixed' (I think) a bug in deluge-console. Please how may I submit it for approval / checkin? Here is the stacktrace:

16:58:57.792 [ERROR   ][deluge.ui.console.modes.basemode                      :1207] 'ascii' codec can't encode character u'\xf9' in position 15: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/deluge-2.0.0b2.dev141-py2.7.egg/deluge/ui/console/modes/", line 210, in doRead
  File "/usr/local/lib/python2.7/dist-packages/deluge-2.0.0b2.dev141-py2.7.egg/deluge/ui/console/modes/torrentlist/", line 286, in read_input
  File "/usr/local/lib/python2.7/dist-packages/deluge-2.0.0b2.dev141-py2.7.egg/deluge/ui/console/modes/torrentlist/", line 195, in handle_read
  File "/usr/local/lib/python2.7/dist-packages/deluge-2.0.0b2.dev141-py2.7.egg/deluge/ui/console/modes/torrentlist/", line 223, in refresh
  File "/usr/local/lib/python2.7/dist-packages/deluge-2.0.0b2.dev141-py2.7.egg/deluge/ui/console/modes/torrentlist/", line 325, in update_torrents
    trim=False, scr=self.torrentlist.torrentview_panel,
  File "/usr/local/lib/python2.7/dist-packages/deluge-2.0.0b2.dev141-py2.7.egg/deluge/ui/console/modes/", line 160, in add_string
    return add_string(row, string, screen, self.encoding, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/deluge-2.0.0b2.dev141-py2.7.egg/deluge/ui/console/modes/", line 290, in add_string
    screen.addstr(row, col, string, color)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf9' in position 15: ordinal not in range(128)

Here is my proposed fix:

~/deluge $ git diff deluge/ui/console/modes/
diff --git a/deluge/ui/console/modes/ b/deluge/ui/console/modes/
index 6226d1bc1..804ccdb42 100644
--- a/deluge/ui/console/modes/
+++ b/deluge/ui/console/modes/
@@ -287,6 +287,7 @@ def add_string(row, fstring, screen, encoding, col=0, pad=True, pad_char=' ', tr
                 string = string[0:remaining_chrs]

+            string = string.encode( encoding )
             screen.addstr(row, col, string, color)
         except curses.error as ex:
             # Ignore exception for writing offscreen.[/code]



Change History (3)

comment:1 Changed 6 years ago by Cas

  • Milestone changed from needs verified to 2.0.0
  • Owner set to Cas
  • Status changed from new to assigned

comment:3 Changed 6 years ago by Cas

  • Resolution set to Fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.