commit c22daac3e78f01eb1b34934ce2cc441ffc8a2e42
parent 20d3a6cfd601388ed5148d0c0032765cf8ce90c0
Author: Nicolas Pouillard <nicolas.pouillard@gmail.com>
Date: Mon, 6 Jul 2009 09:50:09 +0200
easy_decode now also catches InvalidCharacter
Diffstat:
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git 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
@@ -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