From 88df74ae9ae2c81aff725f78eb9cfe5372209021 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 22 Mar 2012 16:20:06 +0900 Subject: [PATCH] work around \0 in string --- aqt/editor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aqt/editor.py b/aqt/editor.py index 4215023cb..a8e05caaf 100644 --- a/aqt/editor.py +++ b/aqt/editor.py @@ -368,7 +368,10 @@ class Editor(object): # focus lost or key/button pressed? if str.startswith("blur") or str.startswith("key"): (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() if not self.addMode: self.note.flush()