lib/ably/modules/conversions.rb in ably-1.0.5 vs lib/ably/modules/conversions.rb in ably-1.0.6

- old
+ new

@@ -94,10 +94,10 @@ # def ensure_utf_8(field_name, string_value, options = {}) unless options[:allow_nil] && string_value.nil? raise ArgumentError, "#{field_name} must be a String" unless string_value.kind_of?(String) end - string_value.encode!(Encoding::UTF_8) if string_value + string_value.encode(Encoding::UTF_8) if string_value rescue Encoding::UndefinedConversionError, Encoding::InvalidByteSequenceError => e raise ArgumentError, "#{field_name} could not be converted to UTF-8: #{e.message}" end # Ensures that the payload is a type supported by all Ably client libraries.