From 7385cb4addba8bd4dd51cd92f8386284a1aa900e Mon Sep 17 00:00:00 2001 From: XD-DENG Date: Sun, 30 Jul 2017 12:19:01 +0800 Subject: [PATCH] Minor change to support Chinese character in note feature --- database.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/database.py b/database.py index d05efbc..81400fe 100644 --- a/database.py +++ b/database.py @@ -92,10 +92,8 @@ def write_note_into_db(id, note_to_write): _conn = sqlite3.connect(note_db_file_location) _c = _conn.cursor() - current_timestamp = str(datetime.datetime.now()) - command = "insert into notes values('" + id.upper() + "', '" + \ - current_timestamp + "', '" + note_to_write + \ - "', '" + hashlib.sha1(id.upper() + current_timestamp + note_to_write).hexdigest() + "');" + current_timestamp = str(datetime.datetime.now()) + command = u"insert into notes values('{0}', '{1}', '{2}', '{3}');".format(id.upper(), current_timestamp, note_to_write, hashlib.sha1(id.upper() + current_timestamp).hexdigest()) _c.execute(command) _conn.commit()