mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:01:18 +08:00
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:
@ -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)
|
||||
|
Reference in New Issue
Block a user