LDAP_OPT_UTF8_IO

Use the LDAP_OPT_UTF8_IO setting to specify whether the LDAP library automatically converts string data to and from the local code page.

The API can be set to either LDAP_UTF8_XLATE_ON or LDAP_UTF8_XLATE_OFF. By default, the LDAP library does not convert string data.

When conversion is disabled by default, the LDAP library assumes that data received from the application by using LDAP APIs is already represented in UTF-8. Similarly, the LDAP library assumes that the application is prepared to receive string data from the LDAP library represented in UTF-8, or as binary.

When LDAP_UTF8_XLATE_ON is set, the LDAP library assumes that string data received from the application by using LDAP APIs is in the default or explicitly designated code page. Similarly, all string data that is returned from the LDAP library back to the application is converted to the designated local code page.

Only string data that is supplied on connection-based APIs is translated, that is, only those APIs that include a ld are subject to translation.

Translation of strings from a UTF-8 encoding to local code page can result in loss of data. The loss occurs when one or more characters in the UTF-8 encoding cannot be represented in the local code page. When this translation occurs, a substitution character replaces any UTF-8 characters that cannot be converted to the local code page.

For more information about explicitly setting the locale for conversions, see ldap_set_locale(). For example:
  int value;
  ldap_set_option( ld, LDAP_OPT_UTF8_IO, (void*)LDAP_UTF8_XLATE_ON);
  ldap_get_option( ld, LDAP_OPT_UTF8_IO, &value);