diff --git a/lib/amq/protocol/client.rb b/lib/amq/protocol/client.rb index 45b565e..62491da 100644 --- a/lib/amq/protocol/client.rb +++ b/lib/amq/protocol/client.rb @@ -174,7 +174,7 @@ def self.encode_body(body, channel, frame_size) # Otherwise String#slice on 1.9 will operate with code points, # and we need bytes. MK. - body.force_encoding("ASCII-8BIT") if RUBY_VERSION.to_f >= 1.9 + body.force_encoding("ASCII-8BIT") if RUBY_VERSION.to_f >= 1.9 && body.encoding != Encoding::BINARY array = Array.new while body && !body.empty?