don't throw error when invalid utf8 found in % escape

This commit is contained in:
Damien Elmes 2012-06-15 02:19:33 +09:00
parent 21f5132c0b
commit 8a414fff29

View file

@ -477,7 +477,8 @@ class Editor(object):
# misbehaving apps may include a null byte in the text # misbehaving apps may include a null byte in the text
txt = txt.replace("\x00", "") txt = txt.replace("\x00", "")
# reverse the url quoting we added to get images to display # reverse the url quoting we added to get images to display
txt = unicode(urllib2.unquote(txt.encode("utf8")), "utf8") txt = unicode(urllib2.unquote(
txt.encode("utf8")), "utf8", "replace")
self.note.fields[self.currentField] = txt self.note.fields[self.currentField] = txt
self.mw.requireReset() self.mw.requireReset()
if not self.addMode: if not self.addMode: