#1140: Console ui "add" autocomplete crashes on unicode filename
--------------------+-------------------------------------------------------
 Reporter:  nullie  |       Owner:       
     Type:  defect  |      Status:  new  
 Priority:  major   |   Milestone:       
Component:  other   |     Version:  1.2.0
 Keywords:          |  
--------------------+-------------------------------------------------------
 Console ui crashes then I try to list options for add command autocomplete
 and directory contains unicode filenames, i.e.:

 {{{
 add /path/to/directory/with/unicode/entries/ <TAB> <TAB>
 }}}

 Traceback:
 {{{
 [ERROR   ] 23:17:28 screen:300 'ascii' codec can't decode byte 0xd0 in
 position 13: ordinal not in range(128)
 Traceback (most recent call last):
   File "/home/nullie/work/deluge/trunk/deluge/ui/console/screen.py", line
 298, in doRead
     self._doRead()
   File "/home/nullie/work/deluge/trunk/deluge/ui/console/screen.py", line
 337, in _doRead
     self.input, self.input_cursor = self.tab_completer(self.input,
 self.input_cursor, second_hit)
   File "/home/nullie/work/deluge/trunk/deluge/ui/console/main.py", line
 377, in tab_completer
     self.write(match)
   File "/home/nullie/work/deluge/trunk/deluge/ui/console/main.py", line
 268, in write
     self.screen.add_line(line, not self.batch_write)
   File "/home/nullie/work/deluge/trunk/deluge/ui/console/screen.py", line
 193, in add_line
     line_length = colors.get_line_length(line)
   File "/home/nullie/work/deluge/trunk/deluge/ui/console/colors.py", line
 129, in get_line_length
     line = line.encode(encoding, "replace")
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 13:
 ordinal not in range(128)
 }}}

 That happens because os.listdir in deluge/ui/console/commands/add.py:94
 gets encoded string, so it returns encoded strings as result, and
 screen.py doesn't handle encoded strings.

 I could fix this, but don't know where should I do decoding (or make
 screen accept encoded strings).

-- 
Ticket URL: <http://dev.deluge-torrent.org/ticket/1140>
Deluge <http://deluge-torrent.org/>
Deluge project

-- 
You received this message because you are subscribed to the Google Groups 
"Deluge Dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-dev?hl=en.

Reply via email to