1<html> 2<head> 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> 6</head> 7<body> 8 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> 17 18<hr> 19<!-- Creator : groff version 1.17 --> 20<a name="NAME"></a> 21<h2>NAME</h2> 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%"> 26bind_textdomain_codeset - set encoding of message translations</td></table> 27<a name="SYNOPSIS"></a> 28<h2>SYNOPSIS</h2> 29 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> 35 36char * 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> 40<h2>DESCRIPTION</h2> 41 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%"> 46The <b>bind_textdomain_codeset</b> function sets the output 47codeset for message catalogs for domain 48<i>domainname</i>.</td></table> 49 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%"> 54A message domain is a set of translatable <i>msgid</i> 55messages. Usually, every software package has its own 56message domain.</td></table> 57 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%"> 62By default, the <b>gettext</b> family of functions returns 63translated messages in the locale's character encoding, 64which can be retrieved as <b>nl_langinfo(CODESET)</b>. The 65need for calling <b>bind_textdomain_codeset</b> arises for 66programs which store strings in a locale independent way 67(e.g. UTF-8) and want to avoid an extra character set 68conversion on the returned translated messages.</td></table> 69 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> 75 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%"> 80If <i>codeset</i> is not NULL, it must be a valid encoding 81name which can be used for the <b>iconv_open</b> function. 82The <b>bind_textdomain_codeset</b> function sets the output 83codeset for message catalogs belonging to domain 84<i>domainname</i> to <i>codeset</i>. The function makes 85copies of the argument strings as needed.</td></table> 86 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%"> 91If <i>codeset</i> is NULL, the function returns the 92previously set codeset for domain <i>domainname</i>. The 93default is NULL, denoting the locale's character 94encoding.</td></table> 95<a name="RETURN VALUE"></a> 96<h2>RETURN VALUE</h2> 97 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%"> 102If successful, the <b>bind_textdomain_codeset</b> function 103returns the current codeset for domain <i>domainname</i>, 104after possibly changing it. The resulting string is valid 105until the next <b>bind_textdomain_codeset</b> call for the 106same <i>domainname</i> and must not be modified or freed. If 107a memory allocation failure occurs, it sets <b>errno</b> to 108<b>ENOMEM</b> and returns NULL. If no codeset has been set 109for domain <i>domainname</i>, it returns NULL.</td></table> 110<a name="ERRORS"></a> 111<h2>ERRORS</h2> 112 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%"> 117The following error can occur, among others:</td></table> 118 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> 124 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%"> 129Not enough memory available.</td></table> 130<a name="BUGS"></a> 131<h2>BUGS</h2> 132 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%"> 137The return type ought to be <b>const char *</b>, but is 138<b>char *</b> to avoid warnings in C code predating ANSI 139C.</td></table> 140<a name="SEE ALSO"></a> 141<h2>SEE ALSO</h2> 142 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> 151<hr> 152</body> 153</html> 154