Skip to content

Encoding::UndefinedConversionError after upgrading from 0.2.2 to 0.3.1 #30

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
MaffooClock opened this issue Feb 20, 2012 · 10 comments
Closed

Comments

@MaffooClock
Copy link

I have a model that uses net-ldap for communication to an Active Directory server, and after upgrading the gem from v0.2.2 to v0.3.1, I get a Encoding::UndefinedConversionError exception when binding and performing a query. When I downgrade to 0.2.2, the problem goes away instantly. It looks like it may be due to the recent changes to use UTF-8 string encoding by default.

It seems that my application encounters this only when I am searching AD using a GUID, which would indicate that net-ldap is trying to convert the binary GUID to UTF-8.

@DavidJLee
Copy link

I've also run into this issue. The issue arrose from commit 3a8b8a2 in lib/net/ber/core_ext/string.rb

The to_ber method calls raw_utf8_encoded which encodes the string and breaks binary searching.

@perfect
Copy link

perfect commented Feb 29, 2012

yes I have the issue, too. How to fix the issues in v0.3.1?

@danielpuglisi
Copy link

+1

@Mazwak
Copy link

Mazwak commented May 2, 2012

This problem seems to come from a confusion between LDAPString and BERString. I think issue #31,#33 and #41 are all related to this.

Roryo asks on #31 : "why doesn't Net::BER::Extensions::String isn't UTF-8?"

I think that's because BER String are used for two things :

  • LDAP String
  • Binary data

From the issue above, we have at least two concrete examples of binary data :

  • paged search cookie
  • AD GUID

IMO, BER should not bother with string encoding, and leave it either to the users to properly encode their strings, or to the LDAP methods.

@pencil
Copy link

pencil commented Jun 14, 2012

I run into this issue when trying to save some binary data (a jpeg photo) into our LDAP. Are there any news on this? Workaround?

@pencil
Copy link

pencil commented Jun 14, 2012

Used @justcfx2u version (#41) and it seems to work.

@mentalbrew
Copy link

Same issue here. This has been open for 5 months. Is this project dead?

@jefferai
Copy link

jefferai commented Sep 6, 2012

Looks like pull 41 got merged into master, so just waiting on a release...

@jishaq
Copy link

jishaq commented Nov 21, 2013

I am having the same problem. It looks like the owner of net-ldap needs to build a new version of this gem, because the 0.3.1 release does not include the fix from pull 41. I worked around this by explicitly using the last-known version of this gem that does NOT suffer from this issue, which is 0.2.2. For me, this is easier than the alternatives (building my own local copy of the current 0.5.0 gem, etc).

And my goodness, the interweb is simply littered with ldap gems!

myfile.rb:

gem 'net-ldap', '=0.2.2'
require 'net-ldap'

# This will be a version 0.2.2 instance of Net::LDAP, which
# doesn't suffer from the Encoding::UndefinedConversionError bug 
ldap = Net::LDAP.new
# and so on

@schaary
Copy link
Member

schaary commented Oct 5, 2014

It's solved since version 0.4.1

@schaary schaary closed this as completed Oct 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants