xref: /netbsd-src/external/gpl2/gettext/dist/gettext-runtime/man/bind_textdomain_codeset.3.html (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1*946379e7Schristos<html>
2*946379e7Schristos<head>
3*946379e7Schristos<meta name="generator" content="groff -Thtml, see www.gnu.org">
4*946379e7Schristos<meta name="Content-Style" content="text/css">
5*946379e7Schristos<title>BIND_TEXTDOMAIN_CODESET</title>
6*946379e7Schristos</head>
7*946379e7Schristos<body>
8*946379e7Schristos
9*946379e7Schristos<h1 align=center>BIND_TEXTDOMAIN_CODESET</h1>
10*946379e7Schristos<a href="#NAME">NAME</a><br>
11*946379e7Schristos<a href="#SYNOPSIS">SYNOPSIS</a><br>
12*946379e7Schristos<a href="#DESCRIPTION">DESCRIPTION</a><br>
13*946379e7Schristos<a href="#RETURN VALUE">RETURN VALUE</a><br>
14*946379e7Schristos<a href="#ERRORS">ERRORS</a><br>
15*946379e7Schristos<a href="#BUGS">BUGS</a><br>
16*946379e7Schristos<a href="#SEE ALSO">SEE ALSO</a><br>
17*946379e7Schristos
18*946379e7Schristos<hr>
19*946379e7Schristos<!-- Creator     : groff version 1.17 -->
20*946379e7Schristos<a name="NAME"></a>
21*946379e7Schristos<h2>NAME</h2>
22*946379e7Schristos<table width="100%" border=0 rules="none" frame="void"
23*946379e7Schristos       cols="2" cellspacing="0" cellpadding="0">
24*946379e7Schristos<tr valign="top" align="left">
25*946379e7Schristos<td width="10%"></td><td width="90%">
26*946379e7Schristosbind_textdomain_codeset - set encoding of message translations</td></table>
27*946379e7Schristos<a name="SYNOPSIS"></a>
28*946379e7Schristos<h2>SYNOPSIS</h2>
29*946379e7Schristos
30*946379e7Schristos<table width="100%" border=0 rules="none" frame="void"
31*946379e7Schristos       cols="2" cellspacing="0" cellpadding="0">
32*946379e7Schristos<tr valign="top" align="left">
33*946379e7Schristos<td width="10%"></td><td width="90%">
34*946379e7Schristos<pre><b>#include &lt;libintl.h&gt;
35*946379e7Schristos
36*946379e7Schristoschar * bind_textdomain_codeset (const char *</b> <i>domainname</i><b>,
37*946379e7Schristos                                const char *</b> <i>codeset</i><b>);
38*946379e7Schristos</b></pre></td></table>
39*946379e7Schristos<a name="DESCRIPTION"></a>
40*946379e7Schristos<h2>DESCRIPTION</h2>
41*946379e7Schristos
42*946379e7Schristos<table width="100%" border=0 rules="none" frame="void"
43*946379e7Schristos       cols="2" cellspacing="0" cellpadding="0">
44*946379e7Schristos<tr valign="top" align="left">
45*946379e7Schristos<td width="10%"></td><td width="90%">
46*946379e7SchristosThe <b>bind_textdomain_codeset</b> function sets the output
47*946379e7Schristoscodeset for message catalogs for domain
48*946379e7Schristos<i>domainname</i>.</td></table>
49*946379e7Schristos
50*946379e7Schristos<table width="100%" border=0 rules="none" frame="void"
51*946379e7Schristos       cols="2" cellspacing="0" cellpadding="0">
52*946379e7Schristos<tr valign="top" align="left">
53*946379e7Schristos<td width="10%"></td><td width="90%">
54*946379e7SchristosA message domain is a set of translatable <i>msgid</i>
55*946379e7Schristosmessages. Usually, every software package has its own
56*946379e7Schristosmessage domain.</td></table>
57*946379e7Schristos
58*946379e7Schristos<table width="100%" border=0 rules="none" frame="void"
59*946379e7Schristos       cols="2" cellspacing="0" cellpadding="0">
60*946379e7Schristos<tr valign="top" align="left">
61*946379e7Schristos<td width="10%"></td><td width="90%">
62*946379e7SchristosBy default, the <b>gettext</b> family of functions returns
63*946379e7Schristostranslated messages in the locale's character encoding,
64*946379e7Schristoswhich can be retrieved as <b>nl_langinfo(CODESET)</b>. The
65*946379e7Schristosneed for calling <b>bind_textdomain_codeset</b> arises for
66*946379e7Schristosprograms which store strings in a locale independent way
67*946379e7Schristos(e.g. UTF-8) and want to avoid an extra character set
68*946379e7Schristosconversion on the returned translated messages.</td></table>
69*946379e7Schristos
70*946379e7Schristos<table width="100%" border=0 rules="none" frame="void"
71*946379e7Schristos       cols="2" cellspacing="0" cellpadding="0">
72*946379e7Schristos<tr valign="top" align="left">
73*946379e7Schristos<td width="10%"></td><td width="90%">
74*946379e7Schristos<i>domainname</i> must be a non-empty string.</td></table>
75*946379e7Schristos
76*946379e7Schristos<table width="100%" border=0 rules="none" frame="void"
77*946379e7Schristos       cols="2" cellspacing="0" cellpadding="0">
78*946379e7Schristos<tr valign="top" align="left">
79*946379e7Schristos<td width="10%"></td><td width="90%">
80*946379e7SchristosIf <i>codeset</i> is not NULL, it must be a valid encoding
81*946379e7Schristosname which can be used for the <b>iconv_open</b> function.
82*946379e7SchristosThe <b>bind_textdomain_codeset</b> function sets the output
83*946379e7Schristoscodeset for message catalogs belonging to domain
84*946379e7Schristos<i>domainname</i> to <i>codeset</i>. The function makes
85*946379e7Schristoscopies of the argument strings as needed.</td></table>
86*946379e7Schristos
87*946379e7Schristos<table width="100%" border=0 rules="none" frame="void"
88*946379e7Schristos       cols="2" cellspacing="0" cellpadding="0">
89*946379e7Schristos<tr valign="top" align="left">
90*946379e7Schristos<td width="10%"></td><td width="90%">
91*946379e7SchristosIf <i>codeset</i> is NULL, the function returns the
92*946379e7Schristospreviously set codeset for domain <i>domainname</i>. The
93*946379e7Schristosdefault is NULL, denoting the locale's character
94*946379e7Schristosencoding.</td></table>
95*946379e7Schristos<a name="RETURN VALUE"></a>
96*946379e7Schristos<h2>RETURN VALUE</h2>
97*946379e7Schristos
98*946379e7Schristos<table width="100%" border=0 rules="none" frame="void"
99*946379e7Schristos       cols="2" cellspacing="0" cellpadding="0">
100*946379e7Schristos<tr valign="top" align="left">
101*946379e7Schristos<td width="10%"></td><td width="90%">
102*946379e7SchristosIf successful, the <b>bind_textdomain_codeset</b> function
103*946379e7Schristosreturns the current codeset for domain <i>domainname</i>,
104*946379e7Schristosafter possibly changing it. The resulting string is valid
105*946379e7Schristosuntil the next <b>bind_textdomain_codeset</b> call for the
106*946379e7Schristossame <i>domainname</i> and must not be modified or freed. If
107*946379e7Schristosa memory allocation failure occurs, it sets <b>errno</b> to
108*946379e7Schristos<b>ENOMEM</b> and returns NULL. If no codeset has been set
109*946379e7Schristosfor domain <i>domainname</i>, it returns NULL.</td></table>
110*946379e7Schristos<a name="ERRORS"></a>
111*946379e7Schristos<h2>ERRORS</h2>
112*946379e7Schristos
113*946379e7Schristos<table width="100%" border=0 rules="none" frame="void"
114*946379e7Schristos       cols="2" cellspacing="0" cellpadding="0">
115*946379e7Schristos<tr valign="top" align="left">
116*946379e7Schristos<td width="10%"></td><td width="90%">
117*946379e7SchristosThe following error can occur, among others:</td></table>
118*946379e7Schristos
119*946379e7Schristos<table width="100%" border=0 rules="none" frame="void"
120*946379e7Schristos       cols="2" cellspacing="0" cellpadding="0">
121*946379e7Schristos<tr valign="top" align="left">
122*946379e7Schristos<td width="10%"></td><td width="90%">
123*946379e7Schristos<b>ENOMEM</b></td></table>
124*946379e7Schristos
125*946379e7Schristos<table width="100%" border=0 rules="none" frame="void"
126*946379e7Schristos       cols="2" cellspacing="0" cellpadding="0">
127*946379e7Schristos<tr valign="top" align="left">
128*946379e7Schristos<td width="21%"></td><td width="79%">
129*946379e7SchristosNot enough memory available.</td></table>
130*946379e7Schristos<a name="BUGS"></a>
131*946379e7Schristos<h2>BUGS</h2>
132*946379e7Schristos
133*946379e7Schristos<table width="100%" border=0 rules="none" frame="void"
134*946379e7Schristos       cols="2" cellspacing="0" cellpadding="0">
135*946379e7Schristos<tr valign="top" align="left">
136*946379e7Schristos<td width="10%"></td><td width="90%">
137*946379e7SchristosThe return type ought to be <b>const char *</b>, but is
138*946379e7Schristos<b>char *</b> to avoid warnings in C code predating ANSI
139*946379e7SchristosC.</td></table>
140*946379e7Schristos<a name="SEE ALSO"></a>
141*946379e7Schristos<h2>SEE ALSO</h2>
142*946379e7Schristos
143*946379e7Schristos<table width="100%" border=0 rules="none" frame="void"
144*946379e7Schristos       cols="2" cellspacing="0" cellpadding="0">
145*946379e7Schristos<tr valign="top" align="left">
146*946379e7Schristos<td width="10%"></td><td width="90%">
147*946379e7Schristos<b>gettext</b>(3), <b>dgettext</b>(3), <b>dcgettext</b>(3),
148*946379e7Schristos<b>ngettext</b>(3), <b>dngettext</b>(3),
149*946379e7Schristos<b>dcngettext</b>(3), <b>textdomain</b>(3),
150*946379e7Schristos<b>nl_langinfo</b>(3), <b>iconv_open</b>(3)</td></table>
151*946379e7Schristos<hr>
152*946379e7Schristos</body>
153*946379e7Schristos</html>
154