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

fix accentuated attributes comparison #55

Merged
merged 2 commits into from
Jun 4, 2015

Conversation

maxdelorme
Copy link
Contributor

Because I'm french my attributes in LDAP have some accent : ex Développeur for Developper
The current test of comparison was always wrong because the ldap are ASCII-8BIT string vs hiera which in UTF-8
So to compare attributes, I convert to string and then to UTF-8, by default the string from Openldap are ASCII-8BIT encoding

to compare attributes convert to string and then to UTF-8, by default the string from Openldap are ASCII-8BIT encoding
@yankcrime
Copy link
Owner

Looks reasonable to me - @seanhandley ?

@seanhandley
Copy link
Contributor

@yankcrime Here's my concern:

irb(main):001:0> ['a','b'] == ['b','a']
=> false
irb(main):002:0> ['a','b'].sort == ['b','a'].sort
=> true

@seanhandley
Copy link
Contributor

By using #to_set, we get a reliable concept of equality of sets. With array equality, the ordering of the contents matters.

If you did

entry.send(k).sort.join(",").force_encoding('UTF-8') == [resource[:attributes][k]].flatten.sort.join(",")

then that'd work.

@maxdelorme
Copy link
Contributor Author

I've changed it, thanks for the review.
Feel free to merge :-)

@seanhandley
Copy link
Contributor

Thanks @maxdelorme 👍

seanhandley added a commit that referenced this pull request Jun 4, 2015
fix accentuated attributes comparison
@seanhandley seanhandley merged commit b7e8e26 into yankcrime:master Jun 4, 2015
@maxdelorme maxdelorme deleted the accentuated_attributes branch June 4, 2015 13:37
@maxdelorme
Copy link
Contributor Author

Thanks

2015-06-04 14:38 GMT+02:00 Sean Handley notifications@github.com:

Merged #55 #55.


Reply to this email directly or view it on GitHub
#55 (comment).


Maxime Delorme
Directeur du développement logiciel
4, rue du Faubourg Montmartre, 75009 Paris

Fixe : +33 1 79 74 16 96

Mobile : +33 6 61 52 00 46

Site @ : www.tennaxia.com

http://www.tennaxia.com?signature=logo


http://www.tennaxia.com/actualites/actualites-tennaxia/?signature=newsletter
https://www.linkedin.com/company/tennaxia?signature=linkedin
http://www.viadeo.com/fr/company/tennaxia?signature=viadeo
https://twitter.com/Tennaxia?signature=twitter

Adoptez l'éco-attitude. N'imprimez ce mail que si cela est vraiment
nécessaire !

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

Successfully merging this pull request may close these issues.

3 participants