From 5a64c1bbad0fd4ba929b0d27788a03cdd03a89cc Mon Sep 17 00:00:00 2001 From: Ross Poulton Date: Fri, 1 Jul 2011 18:13:01 +1000 Subject: [PATCH] Fix UnicodeEncodeException errors when submitting tickets with non-ASCII characters. Thanks to gjedeer for the patch! --- helpdesk/lib.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/helpdesk/lib.py b/helpdesk/lib.py index b1e96620..1feef766 100644 --- a/helpdesk/lib.py +++ b/helpdesk/lib.py @@ -17,6 +17,8 @@ try: except ImportError: from base64 import decodestring as b64decode +from django.utils.encoding import smart_str + def send_templated_mail(template_name, email_context, recipients, sender=None, bcc=None, fail_silently=False, files=None): """ send_templated_mail() is a warpper around Django's e-mail routines that @@ -251,6 +253,6 @@ def text_is_spam(text, request): 'comment_author': '', } - return ak.comment_check(text, data=ak_data) + return ak.comment_check(smart_str(text), data=ak_data) return False