vmail 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/vmail/message_formatter.rb +11 -3
- data/lib/vmail/version.rb +1 -1
- metadata +2 -2
@@ -85,7 +85,7 @@ module Vmail
|
|
85
85
|
def format_text_body(part)
|
86
86
|
text = part.body.decoded.gsub("\r", '')
|
87
87
|
charset = part.content_type_parameters && part.content_type_parameters['charset']
|
88
|
-
if charset
|
88
|
+
if charset && charset != 'UTF-8'
|
89
89
|
Iconv.conv('UTF-8//TRANSLIT//IGNORE', charset, text)
|
90
90
|
else
|
91
91
|
text
|
@@ -100,7 +100,11 @@ module Vmail
|
|
100
100
|
stdin.close
|
101
101
|
output = stdout.read
|
102
102
|
charset = part.content_type_parameters && part.content_type_parameters['charset']
|
103
|
-
charset
|
103
|
+
if charset && charset != 'UTF-8'
|
104
|
+
Iconv.conv('UTF-8//TRANSLIT//IGNORE', charset, output)
|
105
|
+
else
|
106
|
+
output
|
107
|
+
end
|
104
108
|
end
|
105
109
|
|
106
110
|
def extract_headers(mail = @mail)
|
@@ -127,7 +131,11 @@ module Vmail
|
|
127
131
|
def utf8(string)
|
128
132
|
return '' unless string
|
129
133
|
return string unless encoding
|
130
|
-
|
134
|
+
if encoding && encoding != 'UTF-8'
|
135
|
+
Iconv.conv('UTF-8//TRANSLIT/IGNORE', encoding, string)
|
136
|
+
else
|
137
|
+
string
|
138
|
+
end
|
131
139
|
rescue
|
132
140
|
puts $!
|
133
141
|
string
|
data/lib/vmail/version.rb
CHANGED