Have parse_body() recover from ASCII-8BIT encoding

Added a test to make sure that the result can be passed into TextCleaner
(which expects UTF-8)
This commit is contained in:
riking
2014-08-28 12:09:42 -07:00
parent 1c9f6159cd
commit 8ddd90daa4
2 changed files with 14 additions and 3 deletions

View File

@ -95,6 +95,7 @@ module Email
def parse_body(message)
body = select_body message
encoding = body.encoding
raise EmptyEmailError if body.strip.blank?
body = discourse_email_trimmer body
@ -103,7 +104,7 @@ module Email
body = EmailReplyParser.parse_reply body
raise EmptyEmailError if body.strip.blank?
body
body.force_encoding(encoding).encode("UTF-8")
end
def select_body(message)