Handle Encoding::UndefinedConversionError

Ruby > 1.9 seems to throw `UndefinedConversionError` with a bad conversion instead of `ArgumentError`. c.f. http://ruby-doc.org/core-2.0/String.html#method-i-encode