In response to:
Note that you cannot use base64 encoding, you have to use utf-8 encoding for special chars instead.
--
I have found that if I have a special character (or a newline) that ldap_add and ldap_modify will automatically do the base64 encoding for you. For example:
<?php
$entry['postalAddress'] = "123 East 456 West\nSuite A103";
ldap_modify($ds, $dn, $entry);
?>
The function or server will take the newline and convert it into base64 automatically (same goes for other special characters).
You may be able to verify by using a command-line ldapsearch
ldapsearch -b "dc=example,dc=com" -x "(cn=Example Person)" postalAddress
You'll see that the result comes up as
dn: cn=Example Person,dc=example,dc=com
postalAddress:: MTIzIEVhc3QgNDU2IFdlc3QKU3VpdGUgQTEwMw==
See the double colons after postal address? That's how LDAP states it's base64 encoded in this case.