bind_textdomain_codeset -- specify encoding for message retrieval


#include <libintl.h>

char * bind_textdomain_codeset (const char * domainname , const char * codeset );


The bind_textdomain_codeset() function can be used to specify the output codeset for message catalogs for domain domainname. The codeset argument shall be a valid codeset name which can be used tor the iconv_open function, or a null pointer. If the codeset argument is the null pointer, then function returns the currently selected codeset for the domain with the name domainname. It shall return a null pointer if no codeset has yet been selected.

Each successive call to bind_textdomain_codeset() function overrrides the settings made by the preceding call with the same domainname.

The bind_textdomain_codeset() function shall return a pointer to a string containing the name of the selected codeset. The string shall be allocated internally in the function and shall not be changed or freed by the user.



The domainname argument is applied to the currently active LC_MESSAGE locale. It is equivalent in syntax and meaning to the domainname argument to textdomain, except that the selection of the domain is valid only for the duration of the call.


The name of the output codeset for the selected domain, or NULL to select the current codeset.

If domainname is the null pointer, or is an empty string, bind_textdomain_codeset() shall fail, but need not set errno.

Return Value

Returns the currently selected codeset name. It returns a null pointer if no codeset has yet been selected.



Insufficient memory available to allocate return value.

See Also

gettext, dgettext, ngettext, dngettext, dcgettext, dcngettext, textdomain, bindtextdomain