Opened 5 years ago

Closed 5 years ago

#13335 closed defect (duplicate)

Non-ASCII characters in messages are handled incorrectly

Reported by: f.poloni@… Owned by: Peter Suter
Priority: low Component: OnSiteNotificationsPlugin
Severity: minor Keywords: unicode
Cc: f.poloni@… Trac Release: 1.2


The plugin fails to send notifications in the case when the ticket summary contains non-ASCII characters.

INotificationFormatter.format produces a bytestring (because it is meant to be sent via e-mail, I presume), which cannot be inserted into the database directly (and the DB insertion in OnSiteMessage.add fails).

Attachments (0)

Change History (2)

comment:1 Changed 5 years ago by anonymous

Quick fix:

--- a/plugins-source/onsitenotificationsplugin/onsitenotifications/
+++ b/plugins-source/onsitenotificationsplugin/onsitenotifications/
@@ -45,7 +45,12 @@ class OnSiteMessage(object):
     def add(cls, env, sid, authenticated, message, realm, target):
-        with env.db_transaction as db:
+    	# message is a str (because it is meant to be sent as e-mail)
+    	# but it may contain unicode characters, so we need to convert it
+    	# to the proper encoding before inserting it into the db
+    	if isinstance(message, str):
+    		message = message.decode('utf-8')
+    	with env.db_transaction as db:
                 INSERT INTO onsitenotification (sid, authenticated, message,
                                                 realm, target)

comment:2 Changed 5 years ago by Peter Suter

Resolution: duplicate
Status: newclosed

Is this still a problem with the latest version of the plugin? It seems like a duplicate of #13196. Please reopen otherwise.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Peter Suter.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.