vmail 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 encoding && encoding.upcase != 'UTF-8'
136
- Iconv.conv('UTF-8//TRANSLIT/IGNORE', encoding, string)
137
- elsif encoding.upcase == 'UTF-8'
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
@@ -1,3 +1,3 @@
1
1
  module Vmail
2
- VERSION = "1.0.8"
2
+ VERSION = "1.0.9"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 8
9
- version: 1.0.8
8
+ - 9
9
+ version: 1.0.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Choi