1 <!-- Creator : groff version 1.18.1 -->
4 <meta name=
"generator" content=
"groff -Thtml, see www.gnu.org">
5 <meta name=
"Content-Style" content=
"text/css">
6 <title>BIND_TEXTDOMAIN_CODESET
</title>
10 <h1 align=center
>BIND_TEXTDOMAIN_CODESET
</h1>
11 <a href=
"#NAME">NAME
</a><br>
12 <a href=
"#SYNOPSIS">SYNOPSIS
</a><br>
13 <a href=
"#DESCRIPTION">DESCRIPTION
</a><br>
14 <a href=
"#RETURN VALUE">RETURN VALUE
</a><br>
15 <a href=
"#ERRORS">ERRORS
</a><br>
16 <a href=
"#BUGS">BUGS
</a><br>
17 <a href=
"#SEE ALSO">SEE ALSO
</a><br>
23 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
24 cols=
"2" cellspacing=
"0" cellpadding=
"0">
25 <tr valign=
"top" align=
"left">
28 <p>bind_textdomain_codeset
− set encoding of message
32 <a name=
"SYNOPSIS"></a>
35 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
36 cols=
"2" cellspacing=
"0" cellpadding=
"0">
37 <tr valign=
"top" align=
"left">
40 <pre><b>#include
<libintl.h
>
42 char * bind_textdomain_codeset (const char *
</b> <i>domainname
</i><b>,
43 const char *
</b> <i>codeset
</i><b>);
47 <a name=
"DESCRIPTION"></a>
51 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
52 cols=
"2" cellspacing=
"0" cellpadding=
"0">
53 <tr valign=
"top" align=
"left">
56 <p>The
<b>bind_textdomain_codeset
</b> function sets the
57 output codeset for message catalogs for domain
58 <i>domainname
</i>.
</p>
60 <p>A message domain is a set of translatable
<i>msgid
</i>
61 messages. Usually, every software package has its own
64 <p>By default, the
<b>gettext
</b> family of functions
65 returns translated messages in the locale
’s character
66 encoding, which can be retrieved as
67 <b>nl_langinfo(CODESET)
</b>. The need for calling
68 <b>bind_textdomain_codeset
</b> arises for programs which
69 store strings in a locale independent way (e.g. UTF-
8) and
70 want to avoid an extra character set conversion on the
71 returned translated messages.
</p>
73 <p><i>domainname
</i> must be a non-empty string.
</p>
75 <p>If
<i>codeset
</i> is not NULL, it must be a valid
76 encoding name which can be used for the
<b>iconv_open
</b>
77 function. The
<b>bind_textdomain_codeset
</b> function sets
78 the output codeset for message catalogs belonging to domain
79 <i>domainname
</i> to
<i>codeset
</i>. The function makes
80 copies of the argument strings as needed.
</p>
82 <p>If
<i>codeset
</i> is NULL, the function returns the
83 previously set codeset for domain
<i>domainname
</i>. The
84 default is NULL, denoting the locale
’s character
88 <a name=
"RETURN VALUE"></a>
91 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
92 cols=
"2" cellspacing=
"0" cellpadding=
"0">
93 <tr valign=
"top" align=
"left">
96 <p>If successful, the
<b>bind_textdomain_codeset
</b>
97 function returns the current codeset for domain
98 <i>domainname
</i>, after possibly changing it. The resulting
99 string is valid until the next
100 <b>bind_textdomain_codeset
</b> call for the same
101 <i>domainname
</i> and must not be modified or freed. If a
102 memory allocation failure occurs, it sets
<b>errno
</b> to
103 <b>ENOMEM
</b> and returns NULL. If no codeset has been set
104 for domain
<i>domainname
</i>, it returns NULL.
</p>
107 <a name=
"ERRORS"></a>
110 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
111 cols=
"2" cellspacing=
"0" cellpadding=
"0">
112 <tr valign=
"top" align=
"left">
113 <td width=
"10%"></td>
115 <p>The following error can occur, among others:
</p>
119 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
120 cols=
"5" cellspacing=
"0" cellpadding=
"0">
121 <tr valign=
"top" align=
"left">
122 <td width=
"11%"></td>
127 <td width=
"13%"></td>
130 <p>Not enough memory available.
</p>
138 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
139 cols=
"2" cellspacing=
"0" cellpadding=
"0">
140 <tr valign=
"top" align=
"left">
141 <td width=
"10%"></td>
143 <p>The return type ought to be
<b>const char *
</b>, but is
144 <b>char *
</b> to avoid warnings in C code predating ANSI
148 <a name=
"SEE ALSO"></a>
151 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
152 cols=
"2" cellspacing=
"0" cellpadding=
"0">
153 <tr valign=
"top" align=
"left">
154 <td width=
"10%"></td>
156 <p><b>gettext
</b>(
3),
<b>dgettext
</b>(
3),
157 <b>dcgettext
</b>(
3),
<b>ngettext
</b>(
3),
158 <b>dngettext
</b>(
3),
<b>dcngettext
</b>(
3),
159 <b>textdomain
</b>(
3),
<b>nl_langinfo
</b>(
3),
160 <b>iconv_open
</b>(
3)
</p>