6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/mail/jdec/message_patch.rb', line 6
def decoded
decoded = super
if Jdec.enabled? && MessagePatch.autodetect?(self)
detected = Detector.detect(decoded)
if detected && detected[:type] == :text
charset = detected[:encoding].downcase
decoded = Mail::Encodings.transcode_charset(decoded.dup.force_encoding(charset), charset, 'utf-8')
[:content_type] = 'text/plain' unless has_content_type?
[:content_type].parameters[:charset] = charset unless has_charset?
else
decoded = Mail::Encodings.transcode_charset(decoded, decoded.encoding, 'utf-8')
end
end
decoded
end
|