bugranger - Bugs: bug #35507, ranger crashes when entering...

 
 

bug #35507: ranger crashes when entering non-ascii directories

Submitter:  None
Submitted:  Sat 11 Feb 2012 10:45:50 AM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 06 Apr 2012 09:34:20 PM UTC, comment #5: 

I had the same problem when using version 1.5.3 so I updated to the git version and the bug seems to be fixed.
Thanks! :)

Anonymous
Wed 14 Mar 2012 03:25:19 PM UTC, comment #4: 

I pushed a fix, can you upgrade and confirm that it works now?

Roman Z. <hut>
Group administrator
Wed 15 Feb 2012 09:46:11 PM UTC, comment #3: 

Okay, I will investigate that.

Roman Z. <hut>
Group administrator
Tue 14 Feb 2012 04:28:19 PM UTC, comment #2: 

Hi,

sorry for the late reply, I’ve been fooled by the top-posting layout and missed your message.

I’m using the Git version that I pulled on Friday, 2012-02-11. I’m running Ranger in UXterm in Ubuntu 11.10. A co-worker has just experienced the exact same problem with UXterm.

(I’m spreading Ranger like hell in my office! Keep up the great work!)

Anonymous
Sat 11 Feb 2012 02:04:52 PM UTC, comment #1: 

Hi, I can enter any directories, even if they have corrupted names. Are you using the newest version of ranger?

Roman Z. <hut>
Group administrator
Sat 11 Feb 2012 10:45:50 AM UTC, original submission:  

Ranger wors fine in my home directory:
/home
  /kaze
    /Applications
    /Documents
    /Musique
    /Téléchargements
    /Vidéos

But it crashes when entering non-ascii dirs, e.g. "Téléchargements" (= downloads):

$ ~/Applications/src/ranger-git/ranger.py
ranger version: 1.5.2, executed with python 2.7.2+
Locale: fr_FR.UTF-8
Current file: /home/kaze/Téléchargements/chatzilla
Traceback (most recent call last):
  File "/home/kaze/Applications/src/ranger-git/ranger/core/main.py", line 132, in main
    fm.loop()
  File "/home/kaze/Applications/src/ranger-git/ranger/core/fm.py", line 191, in loop
    ui.redraw()
  File "/home/kaze/Applications/src/ranger-git/ranger/gui/ui.py", line 261, in redraw
    self.draw()
  File "/home/kaze/Applications/src/ranger-git/ranger/gui/ui.py", line 296, in draw
    fixed_cwd = cwd.encode('utf-8', 'surrogateescape'). \
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)

ranger crashed.  Please report this traceback at:
http://savannah.nongnu.org/bugs/?group=ranger&func=additem

Here’s the dirty workaround I’m using for now — I’m afraid I don’t know Python so I can’t help much:

diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index 5599190..e2cbaff 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -293,8 +293,7 @@ class UI(DisplayableContainer):
        split = cwd.rsplit(os.sep, self.settings.shorten_title)
        if os.sep in split[0]:
          cwd = os.sep.join(split[1:])
-     fixed_cwd = cwd.encode('utf-8', 'surrogateescape'). \
-         decode('utf-8', 'replace')
+     fixed_cwd = cwd
      sys.stdout.write("\033]2;ranger:" + fixed_cwd + "\007")
      sys.stdout.flush()
      self.win.refresh()

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by hut (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-12-14 hut StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2012-02-15 hut StatusWorks For Me In Progress
    2012-02-11 hut StatusNone Works For Me

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code