man-pages/man3/bind_textdomain_codeset.3.html
2021-03-31 01:06:50 +01:00

120 lines
3.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of BIND_TEXTDOMAIN_CODESET</TITLE>
</HEAD><BODY>
<H1>BIND_TEXTDOMAIN_CODESET</H1>
Section: C Library Functions (3)<BR>Updated: May 2001<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
bind_textdomain_codeset - set encoding of message translations
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
<B>#include &lt;<A HREF="file:///usr/include/libintl.h">libintl.h</A>&gt;</B>
<B>char * bind_textdomain_codeset (const char * </B><I>domainname</I><B>,</B>
<B> const char * </B><I>codeset</I><B>);</B>
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The <B>bind_textdomain_codeset</B> function sets the output codeset for message
catalogs for domain <I>domainname</I>.
<P>
A message domain is a set of translatable <I>msgid</I> messages. Usually,
every software package has its own message domain.
<P>
By default, the <B>gettext</B> family of functions returns translated messages
in the locale's character encoding, which can be retrieved as
<B>nl_langinfo(CODESET)</B>. The need for calling <B>bind_textdomain_codeset</B>
arises for programs which store strings in a locale independent way (e.g.
UTF-8) and want to avoid an extra character set conversion on the returned
translated messages.
<P>
<I>domainname</I> must be a non-empty string.
<P>
If <I>codeset</I> is not NULL, it must be a valid encoding name which can be
used for the <B>iconv_open</B> function. The <B>bind_textdomain_codeset</B>
function sets the output codeset for message catalogs belonging to domain
<I>domainname</I> to <I>codeset</I>. The function makes copies of the argument
strings as needed.
<P>
If <I>codeset</I> is NULL, the function returns the previously set codeset for
domain <I>domainname</I>. The default is NULL, denoting the locale's character
encoding.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
If successful, the <B>bind_textdomain_codeset</B> function returns the current
codeset for domain <I>domainname</I>, after possibly changing it. The resulting
string is valid until the next <B>bind_textdomain_codeset</B> call for the same
<I>domainname</I> and must not be modified or freed. If a memory allocation
failure occurs, it sets <B>errno</B> to <B>ENOMEM</B> and returns NULL. If no
codeset has been set for domain <I>domainname</I>, it returns NULL.
<A NAME="lbAF">&nbsp;</A>
<H2>ERRORS</H2>
The following error can occur, among others:
<DL COMPACT>
<DT id="1"><B>ENOMEM</B>
<DD>
Not enough memory available.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>BUGS</H2>
The return type ought to be <B>const char *</B>, but is <B>char *</B> to avoid
warnings in C code predating ANSI C.
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?3+gettext">gettext</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+dgettext">dgettext</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+dcgettext">dcgettext</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+ngettext">ngettext</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+dngettext">dngettext</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+dcngettext">dcngettext</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+textdomain">textdomain</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+nl_langinfo">nl_langinfo</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+iconv_open">iconv_open</A></B>(3)
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="2"><A HREF="#lbAB">NAME</A><DD>
<DT id="3"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="4"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="5"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="6"><A HREF="#lbAF">ERRORS</A><DD>
<DT id="7"><A HREF="#lbAG">BUGS</A><DD>
<DT id="8"><A HREF="#lbAH">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:36 GMT, March 31, 2021
</BODY>
</HTML>