vmail 2.7.0 → 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +2 -1
- data/lib/vmail.rb +0 -2
- data/lib/vmail/message_formatter.rb +4 -5
- data/lib/vmail/showing_headers.rb +0 -2
- data/lib/vmail/showing_message.rb +3 -6
- data/lib/vmail/version.rb +1 -1
- metadata +1 -1
data/README.markdown
CHANGED
@@ -75,7 +75,8 @@ The `.vmailrc` file should look something like this. Substitute your own values.
|
|
75
75
|
--
|
76
76
|
Sent from Vmail. http://danielchoi.com/software/vmail.html
|
77
77
|
|
78
|
-
This file should be formatted in [YAML syntax][1].
|
78
|
+
This file should be formatted in [YAML syntax][1]. If you have any unsual
|
79
|
+
characters in a string value, try putting quotes around that value.
|
79
80
|
|
80
81
|
[1]:http://www.yaml.org/spec/1.2/spec.html
|
81
82
|
|
data/lib/vmail.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'mail'
|
2
2
|
require 'open3'
|
3
|
-
require 'iconv'
|
4
3
|
|
5
4
|
module Vmail
|
6
5
|
class MessageFormatter
|
@@ -82,7 +81,7 @@ module Vmail
|
|
82
81
|
output = "[vmail: html part translated into plaintext by '#{html_tool}']\n\n" + stdout.read
|
83
82
|
charset = part.content_type_parameters && part.content_type_parameters['charset']
|
84
83
|
if charset && charset != 'UTF-8'
|
85
|
-
|
84
|
+
output.encode!('utf-8', charset, undef: :replace, invalid: :replace)
|
86
85
|
else
|
87
86
|
output
|
88
87
|
end
|
@@ -109,12 +108,12 @@ module Vmail
|
|
109
108
|
def utf8(string, this_encoding = encoding)
|
110
109
|
return '' unless string
|
111
110
|
out = if this_encoding && this_encoding.upcase != 'UTF-8'
|
112
|
-
|
111
|
+
string.encode!('utf-8', this_encoding, undef: :replace, invalid: :replace)
|
113
112
|
elsif this_encoding.upcase == 'UTF-8'
|
114
113
|
string
|
115
114
|
else
|
116
|
-
# assume UTF-8
|
117
|
-
|
115
|
+
# assume UTF-8 and convert to ascii
|
116
|
+
string.encode!('us-ascii', 'utf-8', undef: :replace, invalid: :replace)
|
118
117
|
end
|
119
118
|
out
|
120
119
|
rescue
|
@@ -70,11 +70,9 @@ module Vmail
|
|
70
70
|
# [\w-]+ matches charsets like ISO-8851
|
71
71
|
if /charset=([\w-]+)/.match(parts_list)
|
72
72
|
conv_from = /charset=([\w-]+)/.match(parts_list)[1].strip
|
73
|
-
body.
|
74
|
-
body = body.encode!('utf-8', undef: :replace, invalid: :replace)
|
73
|
+
body = body.encode!('utf-8', conv_from, undef: :replace, invalid: :replace)
|
75
74
|
else
|
76
|
-
body.
|
77
|
-
body = body.encode!('us-ascii', undef: :replace, invalid: :replace)
|
75
|
+
body = body.encode!('us-ascii', 'utf-8', undef: :replace, invalid: :replace)
|
78
76
|
end
|
79
77
|
message_text = <<-EOF
|
80
78
|
#{message_id} #{number_to_human_size message.size} #{message.flags} #{parts_list}
|
@@ -86,8 +84,7 @@ EOF
|
|
86
84
|
# 2 calls so we can see more fine grained exceptions
|
87
85
|
message.update(:rfc822 => rfc822)
|
88
86
|
if !message_text.valid_encoding?
|
89
|
-
|
90
|
-
message_text = ic.iconv(message_text)
|
87
|
+
message_text.encode!('utf-8', undef: :replace, invalid: :replace)
|
91
88
|
end
|
92
89
|
|
93
90
|
begin
|
data/lib/vmail/version.rb
CHANGED