Permalink
Browse files

Merge branch 'undefined_conversion_workaround'

  • Loading branch information...
2 parents bd0f3d0 + 0ba2f63 commit 5e1655ac90a3f4b0534e524e698660719a8fa525 @ConradIrwin committed Sep 21, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/mail/fields/unstructured_field.rb
@@ -139,7 +139,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 5e1655a

Please sign in to comment.