伙计们!我收到以下错误消息,我不知道该怎么做。这是一个已知的 net-ldap 错误吗?我尝试更新我的 gem,我已经在互联网上寻找更多信息。第一部分没问题,我从我的 ldap 数据库中获取了我的数据,但最后发生了这个错误。
/usr/local/lib/ruby/gems/1.9.1/gems/net-ldap-0.3.1/lib/net/ber/core_ext/string.rb:23:in
encode': "\x8E" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError) from /usr/local/lib/ruby/gems/1.9.1/gems/net-ldap-0.3.1/lib/net/ber/core_ext/string.rb:23:in
raw_utf8_encoded' 来自 /usr/local/lib/ ruby/gems/1.9.1/gems/net-ldap-0.3.1/lib/net/ber/core_ext/string.rb:15:into_ber' from /usr/local/lib/ruby/gems/1.9.1/gems/net-ldap-0.3.1/lib/net/ldap.rb:1396:in
block in search' 来自 /usr/local/lib/ruby/gems/1.9 .1/gems/net-ldap-0.3.1/lib/net/ldap.rb:1367:inloop' from /usr/local/lib/ruby/gems/1.9.1/gems/net-ldap-0.3.1/lib/net/ldap.rb:1367:in
search' 来自 /usr/local/lib/ruby/gems/1.9.1/gems/net-ldap-0.3。 1/lib/net/ldap.rb:637:在“搜索”中
这里是我的代码:
require 'rubygems'
require 'net/ldap'
ldap = Net::LDAP.new
ldap.host = 'xxxxxx'
ldap.authenticate "cn=admin, dc=xxxx, dc=xxxxx, dc=de", "xxxxx!"
#puts ldap.bind
if ldap.bind
# authentication succeeded
else
# authentication failed
# p ldap.get_operation_result
end
filter = Net::LDAP::Filter.eq("uid", "*")
treebase = "xxxxx, dc=xxxxxx, dc=de"
ldap.search(:base => treebase, :filter => filter) do |entry|
puts "DN: #{entry.dn}"
entry.each do |attribute, values|
puts " #{attribute}:"
values.each do |value|
puts " --->#{value}"
end
end
end