Skip to content

Commit 406c8b7

Browse files
author
Brad Griffin
committed
Fixing condition where bad UTF-8 causes failure
1 parent 8a18267 commit 406c8b7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/net/ber/core_ext/string.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def raw_utf8_encoded
2929
# Strings should be UTF-8 encoded according to LDAP.
3030
# However, the BER code is not necessarily valid UTF-8
3131
begin
32-
self.encode('UTF-8').force_encoding('ASCII-8BIT')
32+
self.encode('UTF-8', invalid: :replace, undef: :replace, replace: '' ).force_encoding('ASCII-8BIT')
3333
rescue Encoding::UndefinedConversionError
3434
self
3535
end

0 commit comments

Comments
 (0)