vmail 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vmail/imap_client.rb +3 -0
- data/lib/vmail/message_formatter.rb +7 -6
- data/lib/vmail/version.rb +1 -1
- metadata +2 -2
data/lib/vmail/imap_client.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
require 'drb'
|
2
3
|
require 'vmail/string_ext'
|
3
4
|
require 'yaml'
|
@@ -484,6 +485,8 @@ EOF
|
|
484
485
|
rescue
|
485
486
|
msg = "Error encountered parsing message index #{index} seqno #{seqno} uid #{uid}:\n#{$!}\n#{$!.backtrace.join("\n")}"
|
486
487
|
log msg
|
488
|
+
log log message_text
|
489
|
+
msg
|
487
490
|
end
|
488
491
|
|
489
492
|
def prefetch_adjacent(index)
|
@@ -26,7 +26,7 @@ module Vmail
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def process_body(target = @mail)
|
29
|
-
if target.header['Content-Type'].to_s =~ /multipart\/mixed/
|
29
|
+
out = if target.header['Content-Type'].to_s =~ /multipart\/mixed/
|
30
30
|
target.parts.map {|part|
|
31
31
|
if part.multipart?
|
32
32
|
part = find_text_or_html_part(target.parts)
|
@@ -41,6 +41,7 @@ module Vmail
|
|
41
41
|
else
|
42
42
|
format_part(target)
|
43
43
|
end
|
44
|
+
out
|
44
45
|
end
|
45
46
|
|
46
47
|
def format_part(part)
|
@@ -84,7 +85,7 @@ module Vmail
|
|
84
85
|
|
85
86
|
def format_text_body(part)
|
86
87
|
text = part.body.decoded.gsub("\r", '')
|
87
|
-
charset = part.content_type_parameters && part.content_type_parameters['charset']
|
88
|
+
charset = (part.content_type_parameters && part.content_type_parameters['charset']) || encoding
|
88
89
|
if charset && charset != 'UTF-8'
|
89
90
|
Iconv.conv('UTF-8//TRANSLIT//IGNORE', charset, text)
|
90
91
|
else
|
@@ -130,11 +131,11 @@ module Vmail
|
|
130
131
|
@encoding ||= @mail.header.charset || 'UTF-8'
|
131
132
|
end
|
132
133
|
|
133
|
-
def utf8(string)
|
134
|
+
def utf8(string, this_encoding = encoding)
|
134
135
|
return '' unless string
|
135
|
-
out = if
|
136
|
-
Iconv.conv('UTF-8//TRANSLIT/IGNORE',
|
137
|
-
elsif
|
136
|
+
out = if this_encoding && this_encoding.upcase != 'UTF-8'
|
137
|
+
Iconv.conv('UTF-8//TRANSLIT/IGNORE', this_encoding, string)
|
138
|
+
elsif this_encoding.upcase == 'UTF-8'
|
138
139
|
string
|
139
140
|
else
|
140
141
|
# assume UTF-8
|
data/lib/vmail/version.rb
CHANGED