Adds correct UTF-8 encoding to Net::BER::BerIdentifiedString#242
Merged
jch merged 1 commit intoruby-ldap:masterfrom Dec 15, 2015
Merged
Adds correct UTF-8 encoding to Net::BER::BerIdentifiedString#242jch merged 1 commit intoruby-ldap:masterfrom
jch merged 1 commit intoruby-ldap:masterfrom
Conversation
Member
|
@andibachmann thank you for taking the time to open this pull request and including helpful comments. I think this should be fine and compatible with the past changes in #212 because we're changing the internal string object. Is there anything else you would like me to review specifically before I merge? |
Author
|
@jch, besides special Encodings like Japanese, Chinese and Korean, I'm pretty sure the code is OK. |
Collaborator
Yes, I have a monkey patch as well as your changes does :) |
Member
|
Thanks all for chiming in. Merging. |
jch
added a commit
that referenced
this pull request
Dec 15, 2015
Adds correct UTF-8 encoding to Net::BER::BerIdentifiedString
astratto
pushed a commit
to astratto/ruby-net-ldap
that referenced
this pull request
Dec 18, 2015
Adds correct UTF-8 encoding to Net::BER::BerIdentifiedString
jsonn
pushed a commit
to jsonn/pkgsrc
that referenced
this pull request
Jan 12, 2016
=== Net::LDAP 0.13.0
* Set a connect_timeout for the creation of a socket
{#243}[ruby-ldap/ruby-net-ldap#243]
* Update bundler before installing gems with bundler
{#245}[ruby-ldap/ruby-net-ldap#245]
* Net::LDAP#encryption accepts string
{#239}[ruby-ldap/ruby-net-ldap#239]
* Adds correct UTF-8 encoding to Net::BER::BerIdentifiedString
{#242}[ruby-ldap/ruby-net-ldap#242]
* Remove 2.3.0-preview since ruby-head already is included
{#241}[ruby-ldap/ruby-net-ldap#241]
* Drop support for ruby 1.9.3
{#240}[ruby-ldap/ruby-net-ldap#240]
* Fixed capitalization of StartTLSError
{#234}[ruby-ldap/ruby-net-ldap#234]
gtanzillo
added a commit
to gtanzillo/manageiq
that referenced
this pull request
Aug 19, 2016
Version 0.14.0 of the gem (actually, starting with 0.13.0) contains a code change that fixes an encoding error (Encoding::UndefinedConversionError) that happens when there are extended characters in a dn. The fix forces utf-8 encoding instead of ASCII-8BIT for objects returned from the directory. See ruby-ldap/ruby-net-ldap#242 https://bugzilla.redhat.com/show_bug.cgi?id=1367600
This was referenced Oct 14, 2019
This was referenced Jan 24, 2023
Closed
Open
Bump net-ldap from 0.11 to 0.16.2 in /_site/play-with-docker/Portus/Portus.1
PhuongTMR/dockerlabs#83
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dear Net-LDAP maintainers
Currently, net-ldap returns values containing umlauts (e.g. 'Müller') with an encoding as 'ASCII-8BIT'.
This is wrong. LDAP in version 3 should encode all data in 'UTF-8' and therefore when
casting returned ''string'' data into a
Net::BER::BerIdentifiedStringthe encoding should be 'UTF-8'.The current code tries to '#encode('UTF-8')' which results in an
Encoding::UndefinedConversionError: "\xC3" from ASCII-8BIT to UTF-8. This error is trappedand the binary string is returned instead.
If we assume that the data coming from our LDAP/AD-Server is correctly encoded in 'UTF-8', there is
no need to use
#encode. The only thing is to set correctly the encoding of the (string) data, i.e. to useforce_encoding.Example:
I must admit that I have only checked the code (and added one test case) for Umlauts (and characters more or less covered by ISO-8859-1). I have no idea how to test against
Korean, Japanese, Russian, or Chinese encodings.
Nevertheless, I am pretty sure that the current code is bogus for any 'non-ASCII' characters.
Please let me know, if you need further details and I'd be happy to help you out.
regards
andi