Permalink
Browse files

Merge remote-tracking branch 'origin/undefined_conversion_workaround'…

… into nmaster
  • Loading branch information...
ConradIrwin committed Jan 24, 2013
2 parents a040c1c + 0ba2f63 commit fffb25a266c813484bbcb83e1e5a20cd9ef973b5
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/mail/fields/unstructured_field.rb
@@ -146,7 +146,13 @@ def fold(prepend = 0) # :nodoc:
line = ""
while !words.empty?
break unless word = words.first.dup
- word.encode!(charset) if defined?(Encoding) && charset
+ if defined?(Encoding) && charset
+ begin
+ word.encode!(charset)
+ rescue Encoding::UndefinedConversionError
+ should_encode = true
+ end
+ end
word = encode(word) if should_encode
word = encode_crlf(word)
# Skip to next line if we're going to go past the limit

0 comments on commit fffb25a

Please sign in to comment.