ruby-amqp / amq-protocol

AMQP 0.9.1 protocol serialization and deserialization implementation for Ruby (2.0+)
http://groups.google.com/group/ruby-amqp
MIT License
48 stars 31 forks source link

Allow frozen strings in message bodies #78

Open djrodgerspryor opened 1 year ago

djrodgerspryor commented 1 year ago

Previously, this didn't work because force_encoding would always be called on the string, which raises an error on frozen strings, even if the forced encoding is the same as the existing encoding.

Now, the encoding is only changed if the given encoding is wrong (non-binary). This means that correctly encoded frozen strings won't be modified.