vmail 1.6.2 → 1.6.3

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.
@@ -86,11 +86,12 @@ module Vmail
86
86
  def format_text_body(part)
87
87
  text = part.body.decoded.gsub("\r", '')
88
88
  charset = (part.content_type_parameters && part.content_type_parameters['charset']) || encoding
89
- if (charset && charset != 'UTF-8') || (text.encoding != 'UTF-8')
90
- Iconv.conv('UTF-8//TRANSLIT//IGNORE', charset, text)
89
+ if (charset && charset != 'UTF-8')
90
+ text.force_encoding(charset)
91
91
  else
92
92
  text
93
93
  end
94
+ text.encode("UTF-8", undef: :replace, replace: "??", invalid: :replace)
94
95
  end
95
96
 
96
97
  # depend on lynx or whatever is set by the VMAIL_HTML_PART_READER
@@ -20,9 +20,11 @@ module Vmail
20
20
  date = @orig_headers['date'].is_a?(String) ? Time.parse(@orig_headers['date']) : @orig_headers['date']
21
21
  quote_header = date ? "On #{date.strftime('%a, %b %d, %Y at %I:%M %p')}, #{sender} wrote:\n\n" : "#{sender} wrote:\n\n"
22
22
  body = quote_header + formatter.process_body
23
- body.encode("UTF-8", undef: :replace, replace: "??")
24
- body.force_encoding("UTF-8")
25
- body = body.gsub(/^(?=>)/, ">").gsub(/^(?!>)/, "> ")
23
+ begin
24
+ body = body.gsub(/^(?=>)/, ">").gsub(/^(?!>)/, "> ")
25
+ rescue
26
+ body = Iconv.conv(body, "US-ASCII//TRANSLIT//IGNORE", "UTF-8").gsub(/^(?=>)/, ">").gsub(/^(?!>)/, "> ")
27
+ end
26
28
  {'from' => "#@name <#@username>", 'to' => primary_recipient, 'cc' => cc, 'subject' => subject, :body => body}
27
29
  end
28
30
 
@@ -1,3 +1,3 @@
1
1
  module Vmail
2
- VERSION = '1.6.2'
2
+ VERSION = '1.6.3'
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 6
8
- - 2
9
- version: 1.6.2
8
+ - 3
9
+ version: 1.6.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Choi
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-02-23 00:00:00 -05:00
17
+ date: 2011-02-24 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency