Ticket #1917: 0002-Fix-UnicodeDecodeError-with-long-torrent-names.patch

File 0002-Fix-UnicodeDecodeError-with-long-torrent-names.patch, 1.1 KB (added by Calum, 15 years ago)
  • deluge/ui/console/modes/format_utils.py

    From 1e328d839cc15593bebc642b9b9bd58cb69b8ccf Mon Sep 17 00:00:00 2001
    From: Calum Lind <calumlind+deluge@gmail.com>
    Date: Wed, 10 Aug 2011 00:33:50 +0100
    Subject: [PATCH 2/2] Fix UnicodeDecodeError with long torrent names
    
    ---
     deluge/ui/console/modes/format_utils.py |    6 +++---
     1 files changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/deluge/ui/console/modes/format_utils.py b/deluge/ui/console/modes/format_utils.py
    index fa064f8..c31de7f 100644
    a b def trim_string(string, w, have_dbls):  
    8484    if w <= 0:
    8585        return ""
    8686    elif w == 1:
    87         return "
"
     87        return u"
"
    8888    elif have_dbls:
    8989        # have to do this the slow way
    9090        chrs = []
    def trim_string(string, w, have_dbls):  
    100100        if width != w:
    101101            chrs.pop()
    102102            chrs.append('.')
    103         return "%s
 "%("".join(chrs))
     103        return u"%s
 "%("".join(chrs))
    104104    else:
    105         return "%s
 "%(string[0:w-2])
     105        return u"%s
 "%(string[0:w-2])
    106106
    107107def format_column(col, lim):
    108108    dbls = 0