Improved error handling of spam emails (also for html parts).

This commit is contained in:
Martin Edenhofer 2015-03-19 08:43:03 +01:00
parent f3b9e612b0
commit 9f035fb7af

View file

@ -142,7 +142,7 @@ class Channel::EmailParser
data[:body] = Encode.conv( mail.html_part.charset.to_s, data[:body] )
data[:body] = data[:body].html2text.to_s.force_encoding('utf-8')
if !data[:body].valid_encoding?
if !data[:body].force_encoding("UTF-8").valid_encoding?
data[:body] = data[:body].encode('utf-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '?')
end