.TH LDAP_CHARSET 3 "22 September 1998" "OpenLDAP LDVERSION" .\" $OpenLDAP$ .\" Copyright 1998-1999 The OpenLDAP Foundation All Rights Reserved. .\" Copying restrictions apply. See COPYRIGHT/LICENSE. .SH NAME ldap_set_string_translators, ldap_t61_to_8859, ldap_8859_to_t61, ldap_translate_from_t61, ldap_translate_to_t61, ldap_enable_translation \- LDAP character set translation routines .SH SYNOPSIS .nf .ft B #include .ft .LP .ft B void ldap_set_string_translators( ld, encode_proc, decode_proc ) .ft LDAP *ld; BERTranslateProc encode_proc; BERTranslateProc decode_proc; .LP .ft B typedef int (*BERTranslateProc)( char **bufp, unsigned long *buflenp, int free_input ); .ft .LP .ft B int ldap_t61_to_8859( bufp, buflenp, free_input ) .ft char **bufp; unsigned long *buflenp; int free_input; .LP .ft B int ldap_8859_to_t61( bufp, buflenp, free_input ) .ft char **bufp; unsigned long *buflenp; int free_input; .LP .ft B int ldap_translate_from_t61( ld, bufp, lenp, free_input ) .ft LDAP *ld; char **bufp; unsigned long *lenp; int free_input; .LP .ft B int ldap_translate_to_t61( ld, bufp, lenp, free_input ) .ft LDAP *ld; char **bufp; unsigned long *lenp; int free_input; .LP .ft B void ldap_enable_translation( ld, entry, enable ) .ft LDAP *ld; LDAPMessage *entry; int enable; .fi .SH DESCRIPTION .LP These routines are used to used to enable translation of character strings used in the LDAP library to and from the T.61 character set used in the LDAP protocol. These functions are only available if the LDAP and LBER libraries are compiled with STR_TRANSLATION defined. It is also possible to turn on character translation by default so that all LDAP library callers will experience translation; see the LDAP Make-common source file for details. .LP .B ldap_set_string_translators() sets the translation routines that will be used by the LDAP library. They are not actually used until the \fIld_lberoptions\fP field of the LDAP structure is set to include the LBER_TRANSLATE_STRINGS option. .LP .B ldap_t61_to_8859() and .B ldap_8859_to_t61() are translation routines for converting between T.61 characters and ISO-8859 characters. The specific 8859 character set used is determined at compile time. .LP .B ldap_translate_from_t61() is used to translate a string of characters from the T.61 character set to a different character set. The actual translation is done using the \fIdecode_proc\fP that was passed to a previous call to .B ldap_set_string_translators(). On entry, \fI*bufp\fP should point to the start of the T.61 characters to be translated and \fI*lenp\fP should contain the number of bytes to translate. If \fIfree_input\fP is non-zero, the input buffer will be freed if translation is a success. If the translation is a success, LDAP_SUCCESS will be returned, \fI*bufp\fP will point to a newly dynamically allocated buffer that contains the translated characters, and \fI*lenp\fP will contain the length of the result. If translation fails, an LDAP error code will be returned. .LP .B ldap_translate_to_t61() is used to translate a string of characters to the T.61 character set from a different character set. The actual translation is done using the \fIencode_proc\fP that was passed to a previous call to .B ldap_set_string_translators(). This function is called just like .B ldap_translate_from_t61(). .LP .B ldap_enable_translation() is used to turn on or off string translation for the LDAP entry \fIentry\fP (typically obtained by calling .B ldap_first_entry() or .B ldap_next_entry() after a successful LDAP search operation). If \fIenable\fP is zero, translation is disabled; if non-zero, translation is enabled. This routine is useful if you need to ensure that a particular attribute is not translated when it is extracted using .B ldap_get_values() or .B ldap_get_values_len(). For example, you would not want to translate a binary attributes such as jpegPhoto. .SH SEE ALSO .BR ldap (3) .SH ACKNOWLEDGEMENTS .B OpenLDAP is developed and maintained by The OpenLDAP Project (http://www.openldap.org/). .B OpenLDAP is derived from University of Michigan LDAP 3.3 Release.