Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-runtime / man / bind_textdomain_codeset.3.html
1 <!-- Creator     : groff version 1.22.3 -->
2 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
3 "http://www.w3.org/TR/html4/loose.dtd">
4 <html>
5 <head>
6 <meta name="generator" content="groff -Thtml, see www.gnu.org">
7 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
8 <meta name="Content-Style" content="text/css">
9 <style type="text/css">
10        p       { margin-top: 0; margin-bottom: 0; vertical-align: top }
11        pre     { margin-top: 0; margin-bottom: 0; vertical-align: top }
12        table   { margin-top: 0; margin-bottom: 0; vertical-align: top }
13        h1      { text-align: center }
14 </style>
15 <title>BIND_TEXTDOMAIN_CODESET</title>
16
17 </head>
18 <body>
19
20 <h1 align="center">BIND_TEXTDOMAIN_CODESET</h1>
21
22 <a href="#NAME">NAME</a><br>
23 <a href="#SYNOPSIS">SYNOPSIS</a><br>
24 <a href="#DESCRIPTION">DESCRIPTION</a><br>
25 <a href="#RETURN VALUE">RETURN VALUE</a><br>
26 <a href="#ERRORS">ERRORS</a><br>
27 <a href="#BUGS">BUGS</a><br>
28 <a href="#SEE ALSO">SEE ALSO</a><br>
29
30 <hr>
31
32
33 <h2>NAME
34 <a name="NAME"></a>
35 </h2>
36
37
38
39 <p style="margin-left:11%; margin-top: 1em">bind_textdomain_codeset
40 &minus; set encoding of message translations</p>
41
42 <h2>SYNOPSIS
43 <a name="SYNOPSIS"></a>
44 </h2>
45
46
47 <p style="margin-left:11%; margin-top: 1em"><b>#include
48 &lt;libintl.h&gt;</b></p>
49
50 <p style="margin-left:11%; margin-top: 1em"><b>char *
51 bind_textdomain_codeset (const char *</b>
52 <i>domainname</i><b>, <br>
53 const char *</b> <i>codeset</i><b>);</b></p>
54
55 <h2>DESCRIPTION
56 <a name="DESCRIPTION"></a>
57 </h2>
58
59
60 <p style="margin-left:11%; margin-top: 1em">The
61 <b>bind_textdomain_codeset</b> function sets the output
62 codeset for message catalogs for domain
63 <i>domainname</i>.</p>
64
65 <p style="margin-left:11%; margin-top: 1em">A message
66 domain is a set of translatable <i>msgid</i> messages.
67 Usually, every software package has its own message
68 domain.</p>
69
70 <p style="margin-left:11%; margin-top: 1em">By default, the
71 <b>gettext</b> family of functions returns translated
72 messages in the locale&rsquo;s character encoding, which can
73 be retrieved as <b>nl_langinfo(CODESET)</b>. The need for
74 calling <b>bind_textdomain_codeset</b> arises for programs
75 which store strings in a locale independent way (e.g. UTF-8)
76 and want to avoid an extra character set conversion on the
77 returned translated messages.</p>
78
79
80 <p style="margin-left:11%; margin-top: 1em"><i>domainname</i>
81 must be a non-empty string.</p>
82
83 <p style="margin-left:11%; margin-top: 1em">If
84 <i>codeset</i> is not NULL, it must be a valid encoding name
85 which can be used for the <b>iconv_open</b> function. The
86 <b>bind_textdomain_codeset</b> function sets the output
87 codeset for message catalogs belonging to domain
88 <i>domainname</i> to <i>codeset</i>. The function makes
89 copies of the argument strings as needed.</p>
90
91 <p style="margin-left:11%; margin-top: 1em">If
92 <i>codeset</i> is NULL, the function returns the previously
93 set codeset for domain <i>domainname</i>. The default is
94 NULL, denoting the locale&rsquo;s character encoding.</p>
95
96 <h2>RETURN VALUE
97 <a name="RETURN VALUE"></a>
98 </h2>
99
100
101 <p style="margin-left:11%; margin-top: 1em">If successful,
102 the <b>bind_textdomain_codeset</b> function returns the
103 current codeset for domain <i>domainname</i>, after possibly
104 changing it. The resulting string is valid until the next
105 <b>bind_textdomain_codeset</b> call for the same
106 <i>domainname</i> and must not be modified or freed. If a
107 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.</p>
110
111 <h2>ERRORS
112 <a name="ERRORS"></a>
113 </h2>
114
115
116 <p style="margin-left:11%; margin-top: 1em">The following
117 error can occur, among others:</p>
118
119 <table width="100%" border="0" rules="none" frame="void"
120        cellspacing="0" cellpadding="0">
121 <tr valign="top" align="left">
122 <td width="11%"></td>
123 <td width="9%">
124
125
126 <p><b>ENOMEM</b></p></td>
127 <td width="2%"></td>
128 <td width="43%">
129
130
131 <p>Not enough memory available.</p></td>
132 <td width="35%">
133 </td></tr>
134 </table>
135
136 <h2>BUGS
137 <a name="BUGS"></a>
138 </h2>
139
140
141 <p style="margin-left:11%; margin-top: 1em">The return type
142 ought to be <b>const char *</b>, but is <b>char *</b> to
143 avoid warnings in C code predating ANSI C.</p>
144
145 <h2>SEE ALSO
146 <a name="SEE ALSO"></a>
147 </h2>
148
149
150
151 <p style="margin-left:11%; margin-top: 1em"><b>gettext</b>(3),
152 <b>dgettext</b>(3), <b>dcgettext</b>(3), <b>ngettext</b>(3),
153 <b>dngettext</b>(3), <b>dcngettext</b>(3),
154 <b>textdomain</b>(3), <b>nl_langinfo</b>(3),
155 <b>iconv_open</b>(3)</p>
156 <hr>
157 </body>
158 </html>