Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

21 lines (15 sloc) 0.745 kB
UTF8 and Net_LDAP:
It is hard to know exactly what entries need utf8 every time you need them,
so here's the simple way to salvation:
Net_LDAP will check internally if utf8 is needed.
// $attr is some text a user entered with funny characters in it.
// If $attr should not be utfized (f.x. userPassword) then utf8Encode
// will not encode the attribute.
$attr = $ldap->utf8Encode($attr);
// now insert the correctly encoded attribute into the directory.
// later when you access the attributes of that user, decode the ones
// that have to be decoded.
$attr = $ldap->utf8Decode( $entry->attributes() );
Thanks to Jan for the code.
Jump to Line
Something went wrong with that request. Please try again.