Skip to content
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

Complete support for UTF-8 #4

Open
RoryO opened this issue May 29, 2011 · 10 comments
Open

Complete support for UTF-8 #4

RoryO opened this issue May 29, 2011 · 10 comments
Assignees

Comments

@RoryO
Copy link
Contributor

RoryO commented May 29, 2011

Internally we're still assuming ASCII-8 on all string, so when doing manipulations between a UTF-8 response from the server and internal strings it will fail with EncodingError on 1.9.

This is likely going to be a huge overhaul and should be a release in itself.

@ghost ghost assigned RoryO May 29, 2011
@gamafranco
Copy link

We're using this Gem and the names of the users have unwanted characters, when we should have Latin characters. I guess this is due to the UTF-8 / ASCII-8 conversion.

Is there a workaround for this?

Thanks.

@RoryO
Copy link
Contributor Author

RoryO commented Jan 9, 2012

Could you give an example on what's actually in the LDAP server, and the incorrect string that's getting returned?

@gamafranco
Copy link

Hi,

Thanks you for your time.

For example, in the LDAP server I have "Inês Gonçalves" and I get "In\xC3\xAAs Gon\xC3\xA7alves".

@doubt72
Copy link

doubt72 commented Apr 25, 2012

We also encountered this issue.

As a workaround: the gem seems to be returning valid UTF-8 text, just in the wrong encoding -- i.e., using force_encoding("UTF-8") on the results returned from LDAP will yield properly encoded text (I've been testing this with Japanese text).

(Ironically, plain ASCII text will be encoded in UTF-8 already, so the force_encoding shouldn't cause issues where there already wasn't one.)

@gamafranco
Copy link

Thanks! It works.

@perlun
Copy link
Contributor

perlun commented Apr 25, 2014

I've also seen this now. Doing like this:

user = ldap.search(
  base: filter_base,
  filter: user_filter,
  attributes: ['samaccountname', 'displayname', 'memberof']
).first
{
  username: user.samaccountname.first,
  name: user.displayname.first.force_encoding('UTF-8')
}

...works, but it's incredibly ugly to have to force encoding like that. Without it, it "works" for users with ASCII (7-bit) safe names, but users with e.g. scandinavian umlauts (åäö) get problems. (#<Encoding::InvalidByteSequenceError: ""\xC3"" on ASCII-8BIT>) when trying to convert the string to JSON)

Is there a plan to resolve this proper in net-ldap at some point? 👍 from my end on such a thing...

@RoryO RoryO removed their assignment Apr 25, 2014
@mtodd mtodd self-assigned this Oct 22, 2014
@net1957
Copy link

net1957 commented Jun 19, 2015

Get the same result on ruby 2.1.6, net-ldap 0.11, windows 8.1 x64
I connect to a French AD server and need to force encoding to UTF-8. (same remark as @doubt72)

ldap returned string "Frédéric" in ASCII-8BIT and I compared it with "Frédéric" in UTF-8 and it matched never.....

Any progress to resolve this is welcome !

@RoryO RoryO closed this as completed Jul 5, 2016
@perlun
Copy link
Contributor

perlun commented Jul 5, 2016

@RoryO - care to provide some more details on why this was closed? Has this been fixed, and if so, in what PR?

@RoryO RoryO reopened this Jul 5, 2016
@vincent-clipet
Copy link

I encountered the same problem on version 0.12.0.
Like @net1957, french LDAP too, problem coming from characters like 'ç', 'é' or 'è'.

For those interested, this bug was fixed directly in Redmine :
https://www.redmine.org/issues/21453
with this patch : https://www.redmine.org/projects/redmine/repository/revisions/15025/diff/trunk/app/models/auth_source_ldap.rb

@chrishough
Copy link

I am having the same issue regarding underscores...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants