module Net::BER::Extensions::String

def to_ber_bin(code = 0x04)

Active Directory
This is required for proper representation of binary data for Microsoft
Converts a string to a BER string but does *not* encode to UTF-8 first.
#
def to_ber_bin(code = 0x04)
  [code].pack('C') + length.to_ber_length_encoding + self
end