ruby-ldap/ruby-net-ldap — pull request #71 by wandns (2013-07-30 14:27:45+00:00)
Title: Don't change the encoding of binary data to UTF-8.

It does not make sense to change the encoding of binary data, i.e., data that
already has the encoding of ASCII-8BIT or BINARY. Data stored in the jpegPhoto
attribute is an example.

irb(main):001:0> binstring = ['FFD8FFE000104A46494600'].pack('H*')
=> "\xFF\xD8\xFF\xE0\x00\x10JFIF\x00"
irb(main):002:0> binstring.encoding
=> #
irb(main):003:0> binstring.respond_to?(:encode)
=> true
irb(main):004:0> binstring.encode('UTF-8')
Encoding::UndefinedConversionError: "\xFF" from ASCII-8BIT to UTF-8
from (irb):4:in `encode'
from (irb):4
from /usr/bin/irb:12:in `

'
irb(main):005:0>