diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-06-21 14:03:47 -0700 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-06-21 14:03:47 -0700 |
commit | b000f049c8447cd96dcd9b1faad2ba9650910ee5 (patch) | |
tree | feb963b013d92e5948d306767afaea043f0114a6 /lib/mail_handler/backends/mail_extensions.rb | |
parent | 884eb6b5e51b9e0e8aa5ae5ed0eeb25fcbda685e (diff) |
Handle the case where an encoding is extracted that iconv doesn't handle.
Diffstat (limited to 'lib/mail_handler/backends/mail_extensions.rb')
-rw-r--r-- | lib/mail_handler/backends/mail_extensions.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/mail_handler/backends/mail_extensions.rb b/lib/mail_handler/backends/mail_extensions.rb index 322c49bb5..6d6a20f8c 100644 --- a/lib/mail_handler/backends/mail_extensions.rb +++ b/lib/mail_handler/backends/mail_extensions.rb @@ -78,7 +78,10 @@ module Mail # invalid character at the end of the string, even # with UTF-8//IGNORE: # http://po-ru.com/diary/fixing-invalid-utf-8-in-ruby-revisited/ - str = Iconv.conv('UTF-8//IGNORE', fix_encoding(encoding), str + " ")[0...-4] + begin + str = Iconv.conv('UTF-8//IGNORE', fix_encoding(encoding), str + " ")[0...-4] + rescue Iconv::InvalidEncoding + end end str end |