Fixed that iconv decoding should catch InvalidEncoding #3153 [jon@siliconcircus.com]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4901 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson
2006-09-02 19:31:45 +00:00
parent 9db407f578
commit bf2bddd29f

View File

@@ -80,7 +80,7 @@ module TMail
def convert_to(text, to, from)
return text unless to && from
text ? Iconv.iconv(to, from, text).first : ""
rescue Iconv::IllegalSequence, Errno::EINVAL
rescue Iconv::IllegalSequence, Iconv::InvalidEncoding, Errno::EINVAL
# the 'from' parameter specifies a charset other than what the text
# actually is...not much we can do in this case but just return the
# unconverted text.