diff --git a/lib/net/ber/core_ext/string.rb b/lib/net/ber/core_ext/string.rb index 26530bff..2c746b06 100644 --- a/lib/net/ber/core_ext/string.rb +++ b/lib/net/ber/core_ext/string.rb @@ -29,7 +29,8 @@ def raw_utf8_encoded # Strings should be UTF-8 encoded according to LDAP. # However, the BER code is not necessarily valid UTF-8 begin - self.encode('UTF-8').force_encoding('ASCII-8BIT') + self.encode('UTF-8', invalid: :replace, undef: :replace, replace: '' ).force_encoding('ASCII-8BIT') + # self.encode('UTF-8').force_encoding('ASCII-8BIT') rescue Encoding::UndefinedConversionError self end