From 197309308207c48f6ff326e9bb911ca43a989eda Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Mon, 26 Feb 2018 12:36:00 +0200 Subject: [PATCH] fromAddress - str, subject - unicode (for simple encoding like for extended) --- src/bitmessageqt/uisignaler.py | 8 +++++--- src/helper_msgcoding.py | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/bitmessageqt/uisignaler.py b/src/bitmessageqt/uisignaler.py index 31921369..e4a23118 100644 --- a/src/bitmessageqt/uisignaler.py +++ b/src/bitmessageqt/uisignaler.py @@ -12,8 +12,9 @@ class UISignaler(QtCore.QThread): updateStatusBar = QtCore.Signal(str) updateSentItemStatusByToAddress = QtCore.Signal(object, str) updateSentItemStatusByAckdata = QtCore.Signal(object, str) - displayNewInboxMessage = QtCore.Signal(object, str, str, object, str) - displayNewSentMessage = QtCore.Signal(object, str, str, str, object, str) + displayNewInboxMessage = QtCore.Signal(object, str, object, object, str) + displayNewSentMessage = QtCore.Signal( + object, str, str, object, object, str) updateNetworkStatusTab = QtCore.Signal(bool, bool, state.Peer) updateNumberOfMessagesProcessed = QtCore.Signal() updateNumberOfPubkeysProcessed = QtCore.Signal() @@ -52,9 +53,10 @@ class UISignaler(QtCore.QThread): self.updateSentItemStatusByAckdata.emit(ackData, message) elif command == 'displayNewInboxMessage': inventoryHash, toAddress, fromAddress, subject, body = data + self.displayNewInboxMessage.emit( inventoryHash, toAddress, fromAddress, - unicode(subject, 'utf-8'), body) + subject, body) elif command == 'displayNewSentMessage': toAddress, fromLabel, fromAddress, subject, message, ackdata = data self.displayNewSentMessage.emit( diff --git a/src/helper_msgcoding.py b/src/helper_msgcoding.py index e644c0a4..0cced7de 100644 --- a/src/helper_msgcoding.py +++ b/src/helper_msgcoding.py @@ -136,8 +136,10 @@ class MsgDecode(object): # Throw away any extra lines (headers) after the subject. if subject: subject = subject.splitlines()[0] - self.subject = subject - self.body = body + # Field types should be the same for all message types + self.subject = unicode(subject, 'utf-8', 'replace') + self.body = unicode(body, 'utf-8', 'replace') + if __name__ == '__main__': import random