summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/feed2imap/imap.rb4
-rw-r--r--lib/feed2imap/rexml_patch.rb2
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/feed2imap/imap.rb b/lib/feed2imap/imap.rb
index 60775e2..4c54456 100644
--- a/lib/feed2imap/imap.rb
+++ b/lib/feed2imap/imap.rb
@@ -144,7 +144,9 @@ class ImapAccount
d = f[0].attr['INTERNALDATE']
s = f[0].attr['ENVELOPE'].subject
if s =~ /^=\?utf-8\?b\?/
- s = Base64::decode64(s.gsub(/^=\?utf-8\?b\?(.*)\?=$/, '\1')).toISO_8859_1('utf-8')
+ s = Base64::decode64(s.gsub(/^=\?utf-8\?b\?(.*)\?=$/, '\1')).force_encoding('utf-8')
+ elsif s =~ /^=\?iso-8859-1\?b\?/
+ s = Base64::decode64(s.gsub(/^=\?iso-8859-1\?b\?(.*)\?=$/, '\1')).force_encoding('iso-8859-1').encode('utf-8')
end
if dryrun
puts "To remove: #{s} (#{d})"
diff --git a/lib/feed2imap/rexml_patch.rb b/lib/feed2imap/rexml_patch.rb
index f991090..7016127 100644
--- a/lib/feed2imap/rexml_patch.rb
+++ b/lib/feed2imap/rexml_patch.rb
@@ -26,7 +26,7 @@ require 'feedparser'
module REXML
module Encoding
def decode(str)
- return str.toUTF8(@encoding)
+ return str.encode(@encoding)
end
def encode(str)
'>1.6Jason A. Donenfeld1-3/+3 2014-04-24dmenu: hide outputJason A. Donenfeld1-1/+1 2014-04-24tests: test for spacesJason A. Donenfeld3-8/+20 2014-04-24Move test instructions to INSTALL.Jason A. Donenfeld2-11/+18 2014-04-24tests: we don't use aggregate-resultsJason A. Donenfeld1-57/+0 2014-04-24Don't prompt for questions when stdin is not a tty.Jason A. Donenfeld3-7/+6 2014-04-24Allow overridable bash.Jason A. Donenfeld16-16/+16 2014-04-24dmenu: check for empty instead of ret codeJason A. Donenfeld1-1/+1 2014-04-24tests: sed doesn't like escaped chars on non-gnuJason A. Donenfeld1-1/+1 2014-04-24tests: run from anywhereJason A. Donenfeld13-4/+16 2014-04-24Turns out aliases were a bad idea.Jason A. Donenfeld14-95/+92 2014-04-24Make gpg_opts an array.Jason A. Donenfeld1-12/+12 2014-04-24Shellcheck errors.Jason A. Donenfeld1-6/+6 2014-04-24tests: todo updateJason A. Donenfeld1-25/+0