I'm a guy like OpenLDAP, but if I'm not mistaken, we have no way to use it with special characters.
However, this does not mean that it is not a good practice to cut out what you know will not be there, especially in usernames or generated binding paths. For instance:
$ myname = preg_replace ("/ [^ a-zA-Z0-9 _ \ -] /", "", $ myname);
This would separate everything except lowercase, uppercase, numbers, underscores, spaces and dashes. It is always safer to use "allow only this" logic, rather than "reject something." You can never think of all things to reject.
source share