From 23cec2d5e994110665862815add56c4a6e7d7791 Mon Sep 17 00:00:00 2001 From: "Soren I. Bjornstad" Date: Tue, 22 Jul 2014 10:36:08 -0500 Subject: [PATCH 1/2] remove urllib.unquote() step in editor Fixes bug #950. We need to keep an eye out for media filename problems, as this line is probably not necessary anymore with changes to the way Anki handles encoding but could potentially introduce issues. --- aqt/editor.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/aqt/editor.py b/aqt/editor.py index bd509338c..9b102b88c 100644 --- a/aqt/editor.py +++ b/aqt/editor.py @@ -449,9 +449,6 @@ class Editor(object): txt = self.mungeHTML(txt) # misbehaving apps may include a null byte in the text txt = txt.replace("\x00", "") - # reverse the url quoting we added to get images to display - txt = unicode(urllib2.unquote( - txt.encode("utf8")), "utf8", "replace") self.note.fields[self.currentField] = txt if not self.addMode: self.note.flush() From 9e69da6c9ad772afaeb7c28c41c40fe54689cbdc Mon Sep 17 00:00:00 2001 From: "Soren I. Bjornstad" Date: Tue, 22 Jul 2014 11:21:39 -0500 Subject: [PATCH 2/2] use Documents/Anki (in English) if no DocumentsLocation Otherwise it gets created directly in the home folder, which is confusing when you would expect that only to happen on older installs which previously used it. --- aqt/profiles.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/aqt/profiles.py b/aqt/profiles.py index f0444fe5e..27009afe0 100644 --- a/aqt/profiles.py +++ b/aqt/profiles.py @@ -224,7 +224,14 @@ and no other programs are accessing your profile folders, then try again.""")) return p else: loc = QDesktopServices.storageLocation(QDesktopServices.DocumentsLocation) - return os.path.join(loc, "Anki") + if loc[:-1] == QDesktopServices.storageLocation( + QDesktopServices.HomeLocation): + # occasionally "documentsLocation" will return the home + # folder because the Documents folder isn't configured + # properly; fall back to an English path + return os.path.expanduser("~/Documents/Anki") + else: + return os.path.join(loc, "Anki") def _loadMeta(self): path = os.path.join(self.base, "prefs.db")