From 85c72f1980a6ee0cff4737a215ca35bd02fc0221 Mon Sep 17 00:00:00 2001 From: brn Date: Fri, 1 Aug 2014 20:04:17 +0300 Subject: [PATCH] Solved Issue #80 UnicodeEncodeError --- onionshare/onionshare.py | 2 +- onionshare_gui/onionshare_gui.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/onionshare/onionshare.py b/onionshare/onionshare.py index dc3dbf29..60539618 100644 --- a/onionshare/onionshare.py +++ b/onionshare/onionshare.py @@ -103,7 +103,7 @@ def index(slug_candidate): return render_template_string( open('{0}/index.html'.format(onionshare_dir)).read(), slug=slug, - filename=os.path.basename(filename), + filename=os.path.basename(filename).decode("utf-8"), filehash=filehash, filesize=filesize, filesize_human=human_readable_filesize(filesize), diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index f6c78702..d0346556 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -38,7 +38,7 @@ class Window(QWebView): def __init__(self, basename, webapp_port): global window_icon QWebView.__init__(self) - self.setWindowTitle("{0} | OnionShare".format(basename)) + self.setWindowTitle(u"{0} | OnionShare".format(basename.decode("utf-8"))) self.resize(580, 400) self.setMinimumSize(580, 400) self.setMaximumSize(580, 400) @@ -65,7 +65,7 @@ def select_file(strings, filename=None): if not filename: return False, False - filename = str(filename) + filename = str(unicode(filename).encode("utf-8")) # validate filename if not os.path.isfile(filename):