work around \0 in string

This commit is contained in:
Damien Elmes 2012-03-22 16:20:06 +09:00
parent 24155cf337
commit 88df74ae9a

View file

@ -368,7 +368,10 @@ class Editor(object):
# focus lost or key/button pressed? # focus lost or key/button pressed?
if str.startswith("blur") or str.startswith("key"): if str.startswith("blur") or str.startswith("key"):
(type, txt) = str.split(":", 1) (type, txt) = str.split(":", 1)
self.note.fields[self.currentField] = self.mungeHTML(txt) txt = self.mungeHTML(txt)
# misbehaving apps may include a null byte in the text
txt = txt.replace("\x00", "")
self.note.fields[self.currentField] = txt
self.mw.requireReset() self.mw.requireReset()
if not self.addMode: if not self.addMode:
self.note.flush() self.note.flush()