1BIND_TEXTDOMAIN_CODESET(3) Library Functions Manual BIND_TEXTDOMAIN_CODESET(3)
2
3
4

NAME

6       bind_textdomain_codeset - set encoding of message translations
7

SYNOPSIS

9       #include <libintl.h>
10
11       char * bind_textdomain_codeset (const char * domainname,
12                                       const char * codeset);
13

DESCRIPTION

15       The  bind_textdomain_codeset  function sets the output codeset for mes‐
16       sage catalogs for domain domainname.
17
18       A message domain is a set  of  translatable  msgid  messages.  Usually,
19       every software package has its own message domain.
20
21       By default, the gettext family of functions returns translated messages
22       in the locale's character encoding, which can be retrieved as  nl_lang‐
23       info(CODESET).  The need for calling bind_textdomain_codeset arises for
24       programs which store strings in a locale independent way (e.g.   UTF-8)
25       and  want  to  avoid  an extra character set conversion on the returned
26       translated messages.
27
28       domainname must be a non-empty string.
29
30       If codeset is not NULL, it must be a valid encoding name which  can  be
31       used  for the iconv_open function. The bind_textdomain_codeset function
32       sets the output  codeset  for  message  catalogs  belonging  to  domain
33       domainname  to  codeset.  The  function  makes  copies  of the argument
34       strings as needed.
35
36       If codeset is NULL, the function returns the previously set codeset for
37       domain domainname. The default is NULL, denoting the locale's character
38       encoding.
39

RETURN VALUE

41       If successful, the bind_textdomain_codeset function returns the current
42       codeset  for domain domainname, after possibly changing it. The result‐
43       ing string is valid until the next bind_textdomain_codeset call for the
44       same  domainname and must not be modified or freed. If a memory alloca‐
45       tion failure occurs, it sets errno to ENOMEM and returns  NULL.  If  no
46       codeset has been set for domain domainname, it returns NULL.
47

ERRORS

49       The following error can occur, among others:
50
51       ENOMEM Not enough memory available.
52

BUGS

54       The  return type ought to be const char *, but is char * to avoid warn‐
55       ings in C code predating ANSI C.
56

SEE ALSO

58       gettext(3),  dgettext(3),  dcgettext(3),   ngettext(3),   dngettext(3),
59       dcngettext(3), textdomain(3), nl_langinfo(3), iconv_open(3)
60
61
62
63GNU gettext 0.18.1                 May 2001         BIND_TEXTDOMAIN_CODESET(3)
Impressum