bearded / ruby-ldap

Ruby/LDAP is an extension library for Ruby. It provides the interface to some LDAP libraries (e.g. OpenLDAP, Netscape SDK and Active Directory). The common API for application development is described in RFC1823 and is supported by Ruby/LDAP.
http://rubyforge.org/projects/ruby-ldap/
Other
66 stars 35 forks source link

LDAP/LDIF UTF-8 friendly regexp #17

Closed mahlonsmith closed 11 years ago

mahlonsmith commented 11 years ago

You can't require 'ldap/ldif' at all in ruby 2.0 due to an invalid multibyte range.

Possible alternatives:

ghost commented 11 years ago

Hello @mahlonsmith, sorry that it took me so long to respond, but how did you tested regex?

I see that it works correctly in version 1.8.6 and 1.8.7 but do not work in 1.9.1, 1.9.3 and 2.0.0

1.9.3p429 :001 > require 'ldap'
 => true 
1.9.3p429 :002 > require 'ldap/ldif'
 => true 
1.9.3p429 :003 > LDAP::LDIF.parse_file('./test/data/ldif8.txt')
ArgumentError: invalid byte sequence in UTF-8
  from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/ruby-ldap-0.9.12/lib/ldap/ldif.rb:107:in `unsafe_char?'
  from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/ruby-ldap-0.9.12/lib/ldap/ldif.rb:324:in `block in parse_entry'
  from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/ruby-ldap-0.9.12/lib/ldap/ldif.rb:186:in `each'
  from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/ruby-ldap-0.9.12/lib/ldap/ldif.rb:186:in `parse_entry'
  from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/ruby-ldap-0.9.12/lib/ldap/ldif.rb:478:in `block in parse_file'
  from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/ruby-ldap-0.9.12/lib/ldap/ldif.rb:436:in `open'
  from /home/user/.rvm/gems/ruby-1.9.3-p429/gems/ruby-ldap-0.9.12/lib/ldap/ldif.rb:436:in `parse_file'
  from (irb):3
  from /home/user/.rvm/rubies/ruby-1.9.3-p429/bin/irb:16:in `<main>'
ghost commented 11 years ago

Closing this in favor of #18