mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Merge pull request #4846 from cfstras/transfer-encoding-8bit
Fix reply-by-mail for 8-bit transfer encodings
This commit is contained in:
@@ -217,6 +217,13 @@ module Email
|
||||
encodings = ["UTF-8", "ISO-8859-1"]
|
||||
encodings.unshift(mail_part.charset) if mail_part.charset.present?
|
||||
|
||||
# mail (>=2.5) decodes mails with 8bit transfer encoding to utf-8, so
|
||||
# always try UTF-8 first
|
||||
if mail_part.content_transfer_encoding == "8bit"
|
||||
encodings.delete("UTF-8")
|
||||
encodings.unshift("UTF-8")
|
||||
end
|
||||
|
||||
encodings.uniq.each do |encoding|
|
||||
fixed = try_to_encode(string, encoding)
|
||||
return fixed if fixed.present?
|
||||
|
||||
Reference in New Issue
Block a user