Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'undefined_conversion_workaround'

  • Loading branch information...
commit 5e1655ac90a3f4b0534e524e698660719a8fa525 2 parents bd0f3d0 + 0ba2f63
Conrad Irwin authored September 20, 2012

Showing 1 changed file with 7 additions and 1 deletion. Show diff stats Hide diff stats

  1. 8  lib/mail/fields/unstructured_field.rb
8  lib/mail/fields/unstructured_field.rb
@@ -139,7 +139,13 @@ def fold(prepend = 0) # :nodoc:
139 139
         line = ""
140 140
         while !words.empty?
141 141
           break unless word = words.first.dup
142  
-          word.encode!(charset) if defined?(Encoding) && charset
  142
+          if defined?(Encoding) && charset
  143
+            begin
  144
+              word.encode!(charset)
  145
+            rescue Encoding::UndefinedConversionError
  146
+              should_encode = true
  147
+            end
  148
+          end
143 149
           word = encode(word) if should_encode
144 150
           word = encode_crlf(word)
145 151
           # Skip to next line if we're going to go past the limit

0 notes on commit 5e1655a

Please sign in to comment.
Something went wrong with that request. Please try again.