summaryrefslogtreecommitdiff
path: root/lib/feed2imap/textconverters.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/feed2imap/textconverters.rb')
-rw-r--r--lib/feed2imap/textconverters.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/feed2imap/textconverters.rb b/lib/feed2imap/textconverters.rb
index ba49193..b28c211 100644
--- a/lib/feed2imap/textconverters.rb
+++ b/lib/feed2imap/textconverters.rb
@@ -61,10 +61,23 @@ class String
return self.gsub!(/\A\s*/m, '').gsub!(/\s*\Z/m,'')
end
+ # Convert a text in inputenc to a text in ISO-8859-1
+ def toISO_8859_1(inputenc)
+ if inputenc.downcase == 'utf-8'
+ begin
+ return self.unpack('U*').pack('C*')
+ rescue
+ return self
+ end
+ else
+ return self
+ end
+ end
+
# Convert a text in inputenc to a text in UTF8
# must take care of wrong input locales
def toUTF8(inputenc)
- if inputenc.downcase! != 'utf-8'
+ if inputenc.downcase != 'utf-8'
# it is said it is not UTF-8. Ensure it is REALLY not UTF-8
begin
if self.unpack('U*').pack('U*') == self