summaryrefslogtreecommitdiff
path: root/lib/feed2imap
diff options
context:
space:
mode:
authorAntonio Terceiro <terceiro@debian.org>2013-08-12 16:15:32 +0200
committerAntonio Terceiro <terceiro@softwarelivre.org>2013-08-13 01:38:12 +0200
commit7f7cc8280a36c55aa1776f75f3c011e66acada06 (patch)
tree488edf4486a5a802b3fae7b13e018df5a6130217 /lib/feed2imap
parent576afd6ce5d0c15a9a14ad8b561793825e706239 (diff)
downloadfeed2imap-7f7cc8280a36c55aa1776f75f3c011e66acada06.tar.gz
feed2imap-7f7cc8280a36c55aa1776f75f3c011e66acada06.tar.bz2
feed2imap-7f7cc8280a36c55aa1776f75f3c011e66acada06.zip
Modernize hancling of encodings
Also, instead of converting from utf-8 to iso-8858-1, we do the other way around since we now live in a utf-8 world.
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)
ubject'>Fix gtk deprecation warningRené 'Necoro' Neumann1-1/+1 2010-04-16TypoRené 'Necoro' Neumann2-3/+3 2010-04-16Do not allow portage's sqlite backend for the moment ... bug #564292René 'Necoro' Neumann2-16/+25 2010-04-15Better sorting of the database types in the preferences.René 'Necoro' Neumann2-6/+6 Now they are displayed from best to worst. 2010-04-15Add notify-python dependency for the version checkerRené 'Necoro' Neumann1-1/+1 2010-04-15Make the database type choice an info messageRené 'Necoro' Neumann2-7/+13 2010-04-15Renamed es_ES to esRené 'Necoro' Neumann1-0/+0 2010-04-15Fixed dependancy of the new_version plugin from "dev-util/git" to ↵Clement Bourgeois1-1/+1 "dev-vcs/git" to follow new Gentoo portage tree modifications 2010-04-14Make some useless info messages being debug statementsRené 'Necoro' Neumann2-34/+17 2010-04-14Improve the C modulesRené 'Necoro' Neumann3-37/+52 2010-04-14Small modifications made to the French translation (typos, grammar).Clement Bourgeois1-69/+69 2010-04-14Fixed the unicode support and stuff ... and also made eix faster :)René 'Necoro' Neumann1-20/+22 2010-04-14Disable debug messages by defaultRené 'Necoro' Neumann1-1/+1 2010-04-13Better eix error inheritance and handlingRené 'Necoro' Neumann1-2/+9 2010-04-13Fix the handling of FilterSets. Fixes bug #558887.René 'Necoro' Neumann2-56/+64 Now FilterSets are a subclass of InstalledSet. And return only these packages, which are installed ... but then all of them. 2010-04-12Updated newsRené 'Necoro' Neumann1-0/+1 2010-04-13Added my name to translators list.Clement Bourgeois1-0/+1