From 873f1d46d2dc8e0da70e66d6cd57341a31b4b285 Mon Sep 17 00:00:00 2001 From: Daniela Feitosa Date: Thu, 10 Sep 2015 11:51:20 +0000 Subject: [PATCH] [ldap plugin] Updated readme --- plugins/ldap/README.md | 1 + plugins/ldap/lib/ldap_authentication.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/ldap/README.md b/plugins/ldap/README.md index b14ca97..706a440 100644 --- a/plugins/ldap/README.md +++ b/plugins/ldap/README.md @@ -13,6 +13,7 @@ Dependences See the Noosfero install file. After install Noosfero, install LDAP dependences: $ gem install net-ldap -v 0.3.1 +$ sudo apt-get install ruby-magic Enable Plugin ------------- diff --git a/plugins/ldap/lib/ldap_authentication.rb b/plugins/ldap/lib/ldap_authentication.rb index eaa7a18..7171858 100644 --- a/plugins/ldap/lib/ldap_authentication.rb +++ b/plugins/ldap/lib/ldap_authentication.rb @@ -136,7 +136,7 @@ class LdapAuthentication def self.get_attr(entry, attr_name) if !attr_name.blank? val = entry[attr_name].is_a?(Array) ? entry[attr_name].first : entry[attr_name] - charset = Magic.guess_string_mime(val).match(/charset=([^\s]+)/)[1] + charset = Magic.guess_string_mime_encoding(val) val.encode 'utf-8', charset, invalid: :replace, undef: :replace end end -- libgit2 0.21.2