From 28a09ee972e4bc3fb84899d35a9b914e6a833561 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 30 Jan 2017 12:56:52 +0530 Subject: [PATCH] [fix] email encoding issues, fixes frappe/erpnext#7145 --- frappe/email/doctype/email_account/email_account.py | 3 ++- frappe/email/doctype/email_account/test_mails/incoming-1.raw | 2 +- frappe/public/js/frappe/form/control.js | 3 ++- frappe/tests/data/email_with_image.txt | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/frappe/email/doctype/email_account/email_account.py b/frappe/email/doctype/email_account/email_account.py index a99e1e184d..65f06f374a 100755 --- a/frappe/email/doctype/email_account/email_account.py +++ b/frappe/email/doctype/email_account/email_account.py @@ -390,7 +390,8 @@ class EmailAccount(Document): # try and match by subject and sender # if sent by same sender with same subject, # append it to old coversation - subject = strip(re.sub("(^\s*(Fw|FW|fwd)[^:]*:|\s*(Re|RE)[^:]*:\s*)*", "", email.subject)) + subject = frappe.as_unicode(strip(re.sub("(^\s*(Fw|FW|fwd)[^:]*:|\s*(Re|RE)[^:]*:\s*)*", + "", email.subject))) parent = frappe.db.get_all(self.append_to, filters={ self.sender_field: email.from_email, diff --git a/frappe/email/doctype/email_account/test_mails/incoming-1.raw b/frappe/email/doctype/email_account/test_mails/incoming-1.raw index 691b863095..c75e2af2d5 100644 --- a/frappe/email/doctype/email_account/test_mails/incoming-1.raw +++ b/frappe/email/doctype/email_account/test_mails/incoming-1.raw @@ -36,7 +36,7 @@ Received: from [192.168.0.100] ([27.106.4.70]) Mon, 15 Sep 2014 03:35:04 -0700 (PDT) From: Rushabh Mehta Content-Type: multipart/alternative; boundary="Apple-Mail=_57F71261-5C3A-43F6-918B-4438B96F61AA" -Subject: test mail +Subject: test mail 🦄🌈😎 Message-Id: <9143999C-8456-4399-9CF1-4A2DA9DD7711@gmail.com> Date: Mon, 15 Sep 2014 16:04:57 +0530 To: Rushabh Mehta diff --git a/frappe/public/js/frappe/form/control.js b/frappe/public/js/frappe/form/control.js index 2c21bedf03..48ac898218 100644 --- a/frappe/public/js/frappe/form/control.js +++ b/frappe/public/js/frappe/form/control.js @@ -1160,7 +1160,8 @@ frappe.ui.form.ControlSelect = frappe.ui.form.ControlData.extend({ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({ make_input: function() { var me = this; - $('