Better way to escape the ldap filter and username

This is a better approach to escaping ldap characters.