3 <meta name=
"generator" content=
"groff -Thtml, see www.gnu.org">
4 <meta name=
"Content-Style" content=
"text/css">
5 <title>BIND_TEXTDOMAIN_CODESET
</title>
9 <h1 align=center
>BIND_TEXTDOMAIN_CODESET
</h1>
10 <a href=
"#NAME">NAME
</a><br>
11 <a href=
"#SYNOPSIS">SYNOPSIS
</a><br>
12 <a href=
"#DESCRIPTION">DESCRIPTION
</a><br>
13 <a href=
"#RETURN VALUE">RETURN VALUE
</a><br>
14 <a href=
"#ERRORS">ERRORS
</a><br>
15 <a href=
"#BUGS">BUGS
</a><br>
16 <a href=
"#SEE ALSO">SEE ALSO
</a><br>
19 <!-- Creator : groff version 1.17 -->
22 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
23 cols=
"2" cellspacing=
"0" cellpadding=
"0">
24 <tr valign=
"top" align=
"left">
25 <td width=
"10%"></td><td width=
"90%">
26 bind_textdomain_codeset - set encoding of message translations
</td></table>
27 <a name=
"SYNOPSIS"></a>
30 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
31 cols=
"2" cellspacing=
"0" cellpadding=
"0">
32 <tr valign=
"top" align=
"left">
33 <td width=
"10%"></td><td width=
"90%">
34 <pre><b>#include
<libintl.h
>
36 char * bind_textdomain_codeset (const char *
</b> <i>domainname
</i><b>,
37 const char *
</b> <i>codeset
</i><b>);
38 </b></pre></td></table>
39 <a name=
"DESCRIPTION"></a>
42 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
43 cols=
"2" cellspacing=
"0" cellpadding=
"0">
44 <tr valign=
"top" align=
"left">
45 <td width=
"10%"></td><td width=
"90%">
46 The
<b>bind_textdomain_codeset
</b> function sets the output
47 codeset for message catalogs for domain
48 <i>domainname
</i>.
</td></table>
50 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
51 cols=
"2" cellspacing=
"0" cellpadding=
"0">
52 <tr valign=
"top" align=
"left">
53 <td width=
"10%"></td><td width=
"90%">
54 A message domain is a set of translatable
<i>msgid
</i>
55 messages. Usually, every software package has its own
56 message domain.
</td></table>
58 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
59 cols=
"2" cellspacing=
"0" cellpadding=
"0">
60 <tr valign=
"top" align=
"left">
61 <td width=
"10%"></td><td width=
"90%">
62 By default, the
<b>gettext
</b> family of functions returns
63 translated messages in the locale's character encoding,
64 which can be retrieved as
<b>nl_langinfo(CODESET)
</b>. The
65 need for calling
<b>bind_textdomain_codeset
</b> arises for
66 programs which store strings in a locale independent way
67 (e.g. UTF-
8) and want to avoid an extra character set
68 conversion on the returned translated messages.
</td></table>
70 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
71 cols=
"2" cellspacing=
"0" cellpadding=
"0">
72 <tr valign=
"top" align=
"left">
73 <td width=
"10%"></td><td width=
"90%">
74 <i>domainname
</i> must be a non-empty string.
</td></table>
76 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
77 cols=
"2" cellspacing=
"0" cellpadding=
"0">
78 <tr valign=
"top" align=
"left">
79 <td width=
"10%"></td><td width=
"90%">
80 If
<i>codeset
</i> is not NULL, it must be a valid encoding
81 name which can be used for the
<b>iconv_open
</b> function.
82 The
<b>bind_textdomain_codeset
</b> function sets the output
83 codeset for message catalogs belonging to domain
84 <i>domainname
</i> to
<i>codeset
</i>. The function makes
85 copies of the argument strings as needed.
</td></table>
87 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
88 cols=
"2" cellspacing=
"0" cellpadding=
"0">
89 <tr valign=
"top" align=
"left">
90 <td width=
"10%"></td><td width=
"90%">
91 If
<i>codeset
</i> is NULL, the function returns the
92 previously set codeset for domain
<i>domainname
</i>. The
93 default is NULL, denoting the locale's character
94 encoding.
</td></table>
95 <a name=
"RETURN VALUE"></a>
98 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
99 cols=
"2" cellspacing=
"0" cellpadding=
"0">
100 <tr valign=
"top" align=
"left">
101 <td width=
"10%"></td><td width=
"90%">
102 If successful, the
<b>bind_textdomain_codeset
</b> function
103 returns the current codeset for domain
<i>domainname
</i>,
104 after possibly changing it. The resulting string is valid
105 until the next
<b>bind_textdomain_codeset
</b> call for the
106 same
<i>domainname
</i> and must not be modified or freed. If
107 a memory allocation failure occurs, it sets
<b>errno
</b> to
108 <b>ENOMEM
</b> and returns NULL. If no codeset has been set
109 for domain
<i>domainname
</i>, it returns NULL.
</td></table>
110 <a name=
"ERRORS"></a>
113 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
114 cols=
"2" cellspacing=
"0" cellpadding=
"0">
115 <tr valign=
"top" align=
"left">
116 <td width=
"10%"></td><td width=
"90%">
117 The following error can occur, among others:
</td></table>
119 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
120 cols=
"2" cellspacing=
"0" cellpadding=
"0">
121 <tr valign=
"top" align=
"left">
122 <td width=
"10%"></td><td width=
"90%">
123 <b>ENOMEM
</b></td></table>
125 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
126 cols=
"2" cellspacing=
"0" cellpadding=
"0">
127 <tr valign=
"top" align=
"left">
128 <td width=
"21%"></td><td width=
"79%">
129 Not enough memory available.
</td></table>
133 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
134 cols=
"2" cellspacing=
"0" cellpadding=
"0">
135 <tr valign=
"top" align=
"left">
136 <td width=
"10%"></td><td width=
"90%">
137 The return type ought to be
<b>const char *
</b>, but is
138 <b>char *
</b> to avoid warnings in C code predating ANSI
140 <a name=
"SEE ALSO"></a>
143 <table width=
"100%" border=
0 rules=
"none" frame=
"void"
144 cols=
"2" cellspacing=
"0" cellpadding=
"0">
145 <tr valign=
"top" align=
"left">
146 <td width=
"10%"></td><td width=
"90%">
147 <b>gettext
</b>(
3),
<b>dgettext
</b>(
3),
<b>dcgettext
</b>(
3),
148 <b>ngettext
</b>(
3),
<b>dngettext
</b>(
3),
149 <b>dcngettext
</b>(
3),
<b>textdomain
</b>(
3),
150 <b>nl_langinfo
</b>(
3),
<b>iconv_open
</b>(
3)
</td></table>