Skip to content

UTF-8 encoding fix. #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixing condition where bad utf-8 causes a failure.
  • Loading branch information
Bryan Kroger committed Jun 22, 2012
commit 401f3a3c33b7f1c82b6074a5f63d4cbf0e385fca
3 changes: 2 additions & 1 deletion lib/net/ber/core_ext/string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def raw_utf8_encoded
if self.respond_to?(:encode)
# Strings should be UTF-8 encoded according to LDAP.
# However, the BER code is not necessarily valid UTF-8
self.encode('UTF-8').force_encoding('ASCII-8BIT')
#self.encode('UTF-8').force_encoding('ASCII-8BIT')
self.encode('UTF-8', invalid: :replace, undef: :replace, replace: '' ).force_encoding('ASCII-8BIT')
else
self
end
Expand Down