From 9fcef7132f7503498398ba13f2cda86be443be2f Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 14 Mar 2012 15:58:27 +0100 Subject: gui.ui: catch an exception with surrogates in "update title" code --- ranger/gui/ui.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py index e6c7d065..69b8463b 100644 --- a/ranger/gui/ui.py +++ b/ranger/gui/ui.py @@ -293,10 +293,13 @@ 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') - sys.stdout.write("\033]2;ranger:" + fixed_cwd + "\007") - sys.stdout.flush() + try: + fixed_cwd = cwd.encode('utf-8', 'surrogateescape'). \ + decode('utf-8', 'replace') + sys.stdout.write("\033]2;ranger:" + fixed_cwd + "\007") + sys.stdout.flush() + except: + pass self.win.refresh() def finalize(self): -- cgit 1.4.1-2-gfad0