Skip to content

Commit 9c826d9

Browse files
author
Richard Dean
committed
Applying fix from Bryan Kroger for bad UTF
1 parent 8a18267 commit 9c826d9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/net/ber/core_ext/string.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ 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')
33+
# self.encode('UTF-8').force_encoding('ASCII-8BIT')
3334
rescue Encoding::UndefinedConversionError
3435
self
3536
end

0 commit comments

Comments
 (0)