[prev in list] [next in list] [prev in thread] [next in thread] 

List:       imp
Subject:    [horde] charset patch for ldap lookup in lib/hooks.php
From:       Aide Florent <faide () alphacent ! com>
Date:       2003-02-28 15:14:46
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello list,

here is a little patch against config/hooks.php.dist cvs head 02/27/2003

I modified the ldap fullname hook to take care of the charset because I did 
not think about it when I wrote the first patch.

The problems arose when I tried to find name with accents in an Netware 5.1 
nldap (which uses utf-8 by default...) the output on screen were horrible 
characters...

I fixed the defaults but maybe someone can rationalize them...

I do not know if I can get the user's charset from some variables so I 
initialized my own but maybe someone can continue upon what I did and get 
those information from the horde config ... (?)

I hope it is usefull to someone.

AIDE Florent.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+X3zwQe8gCED8yYERAr6dAJ4np2GTEvnDrTeoZzOvh+eVtxtEcQCgsgbg
s5eeuVK8cYx2eJbuvWEYvg8=
=Eoad
-----END PGP SIGNATURE-----

["hooks_ldap.diff" (text/x-diff)]

--- hooks.php.dist.old	2003-02-28 15:49:36.000000000 +0100
+++ hooks.php.dist	2003-02-28 15:54:04.000000000 +0100
@@ -184,6 +184,8 @@
         $ldapServer = 'ldap.example.com';
         $ldapPort = '389';
         $searchBase = 'ou=people,o=example.com';
+        $ldapcharset = 'utf-8';
+        $outputcharset = 'iso-8859-1';
 
         $ds = @ldap_connect($ldapServer, $ldapPort);
 
@@ -198,6 +200,7 @@
 
         ldap_close($ds);
 
+		$name = String::convertCharset($name, $ldapcharset, $outputcharset);
         return (empty($name) ? $user : $name);
     }
 }


-- 
Horde mailing list
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: horde-unsubscribe@lists.horde.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic