mailcvt 0.2.25 → 0.2.26
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/encoded_word.rb +7 -1
- data/lib/mailcvt/version.rb +1 -1
- metadata +1 -1
data/lib/encoded_word.rb
CHANGED
@@ -15,7 +15,10 @@ class EncodedWord
|
|
15
15
|
Dir.glob(File.join(@inputdir, File.join('**', '*.mlog'))).select do |f|
|
16
16
|
puts f
|
17
17
|
File.open(f + '.plain', 'w') do |out|
|
18
|
-
File.open(f
|
18
|
+
input = File.open(f)
|
19
|
+
@input_enc = input.external_encoding
|
20
|
+
input.each_line do |line|
|
21
|
+
#File.open(f, :internal_encoding => 'utf-8').each_line do |line|
|
19
22
|
parts = mysplit(line)
|
20
23
|
newparts = []
|
21
24
|
newparts << format_date(parts[0]) #date
|
@@ -60,12 +63,14 @@ class EncodedWord
|
|
60
63
|
|
61
64
|
def decode_subject(sub)
|
62
65
|
return '' unless sub and sub.length > 0
|
66
|
+
sub = sub.encode('utf-8', @input_enc, :undef=>:replace, :invalid=>:replace)
|
63
67
|
one = sub.gsub("\a", '')
|
64
68
|
mime_decode(one)
|
65
69
|
end
|
66
70
|
|
67
71
|
def trim_emails(emails)
|
68
72
|
return '' unless emails and emails.length > 0
|
73
|
+
emails = emails.encode('utf-8', @input_enc, :undef=>:replace, :invalid=>:replace)
|
69
74
|
pos1 = -1
|
70
75
|
newparts = []
|
71
76
|
while true do
|
@@ -96,6 +101,7 @@ class EncodedWord
|
|
96
101
|
|
97
102
|
def decode_attachments(attachments)
|
98
103
|
return '' unless attachments and attachments.length > 0
|
104
|
+
attachments = attachments.encode('utf-8', @input_enc, :undef=>:replace, :invalid=>:replace)
|
99
105
|
parts = mysplit(attachments, "\a")
|
100
106
|
newparts = []
|
101
107
|
parts.each do |p|
|
data/lib/mailcvt/version.rb
CHANGED