diff --git a/lib/net/ber.rb b/lib/net/ber.rb index b8992a92..b4b9e9da 100644 --- a/lib/net/ber.rb +++ b/lib/net/ber.rb @@ -296,9 +296,11 @@ def to_arr class Net::BER::BerIdentifiedString < String attr_accessor :ber_identifier def initialize args - super args - # LDAP uses UTF-8 encoded strings - self.encode('UTF-8') if self.respond_to?(:encoding) rescue self + super begin + args.respond_to?(:encode) ? args.encode('UTF-8') : args + rescue + args + end end end