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.
@@ -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 ? Iconv.conv('UTF-8//TRANSLIT//IGNORE', charset, output) : output
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
- Iconv.conv('UTF-8//TRANSLIT/IGNORE', encoding, string)
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
@@ -1,3 +1,3 @@
1
1
  module Vmail
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 5
9
- version: 0.2.5
8
+ - 6
9
+ version: 0.2.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Choi