> However, how about keeping charset handling in a separate
> library, but provide it as callbacks from the LDAP library?
> Then the entire API would be an ldap_set_option() call to set
> two callbacks. That is, before the LDAP library sends user
> data to the server, it calls something like
> (*send_callback)(operation, "attribute type", "data")
> and sends the result value instead of the original data.
> Similarly, it sends data from the server through
> (*receive_callback)(operation, "attribute type", "data")
> and provides the user with the result instead of the original data.
On working with callbacks take care of situations like that:
You are doing a search and you need all returned strings to be in 8-byte
ISO-8859-1 format.
Following that, you are doing another search over the same connection
but this time you need all returned strings to be in Unicode format.
Additionally take care, that we should have the possibility to have
multiple connections doing different string conversions.
But sure is, string conversions "on the fly" would by very nice.
Patrick