From c22daac3e78f01eb1b34934ce2cc441ffc8a2e42 Mon Sep 17 00:00:00 2001 From: Nicolas Pouillard Date: Mon, 6 Jul 2009 09:50:09 +0200 Subject: [PATCH] easy_decode now also catches InvalidCharacter --- lib/sup/rfc2047.rb | 6 +----- lib/sup/util.rb | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/sup/rfc2047.rb b/lib/sup/rfc2047.rb index fcd5cf0..f31faa1 100644 --- a/lib/sup/rfc2047.rb +++ b/lib/sup/rfc2047.rb @@ -52,11 +52,7 @@ module Rfc2047 # WORD. end - begin - Iconv.easy_decode(target, charset, text) - rescue Iconv::InvalidCharacter - text - end + Iconv.easy_decode(target, charset, text) end end end diff --git a/lib/sup/util.rb b/lib/sup/util.rb index 8f60cc4..d76d2a3 100644 --- a/lib/sup/util.rb +++ b/lib/sup/util.rb @@ -651,7 +651,7 @@ class Iconv begin Iconv.iconv(target + "//IGNORE", charset, text + " ").join[0 .. -2] - rescue Errno::EINVAL, Iconv::InvalidEncoding, Iconv::IllegalSequence => e + rescue Errno::EINVAL, Iconv::InvalidEncoding, Iconv::InvalidCharacter, Iconv::IllegalSequence => e Redwood::log "warning: error (#{e.class.name}) decoding text from #{charset} to #{target}: #{text[0 ... 20]}" text end -- 2.45.2