blob: fc9a789ab6743d29cb277c39b817f08e6a5db4f5 [file] [log] [blame]
<html lang="en">
<head>
<title>Restartable multibyte conversion - The GNU C Library</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="The GNU C Library">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Character-Set-Handling.html#Character-Set-Handling" title="Character Set Handling">
<link rel="prev" href="Charset-Function-Overview.html#Charset-Function-Overview" title="Charset Function Overview">
<link rel="next" href="Non_002dreentrant-Conversion.html#Non_002dreentrant-Conversion" title="Non-reentrant Conversion">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU C library.
This is Edition 0.12, last updated 2007-10-27,
of `The GNU C Library Reference Manual', for version
2.8 (Sourcery G++ Lite 2011.03-41).
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002,
2003, 2007, 2008, 2010 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software Needs Free Documentation''
and ``GNU Lesser General Public License'', the Front-Cover texts being
``A GNU Manual'', and with the Back-Cover Texts as in (a) below. A
copy of the license is included in the section entitled "GNU Free
Documentation License".
(a) The FSF's Back-Cover Text is: ``You have the freedom to
copy and modify this GNU manual. Buying copies from the FSF
supports it in developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
<link rel="stylesheet" type="text/css" href="../cs.css">
</head>
<body>
<div class="node">
<a name="Restartable-multibyte-conversion"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Non_002dreentrant-Conversion.html#Non_002dreentrant-Conversion">Non-reentrant Conversion</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Charset-Function-Overview.html#Charset-Function-Overview">Charset Function Overview</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Character-Set-Handling.html#Character-Set-Handling">Character Set Handling</a>
<hr>
</div>
<h3 class="section">6.3 Restartable Multibyte Conversion Functions</h3>
<p>The ISO&nbsp;C<!-- /@w --> standard defines functions to convert strings from a
multibyte representation to wide character strings. There are a number
of peculiarities:
<ul>
<li>The character set assumed for the multibyte encoding is not specified
as an argument to the functions. Instead the character set specified by
the <code>LC_CTYPE</code> category of the current locale is used; see
<a href="Locale-Categories.html#Locale-Categories">Locale Categories</a>.
<li>The functions handling more than one character at a time require NUL
terminated strings as the argument (i.e., converting blocks of text
does not work unless one can add a NUL byte at an appropriate place).
The GNU C library contains some extensions to the standard that allow
specifying a size, but basically they also expect terminated strings.
</ul>
<p>Despite these limitations the ISO&nbsp;C<!-- /@w --> functions can be used in many
contexts. In graphical user interfaces, for instance, it is not
uncommon to have functions that require text to be displayed in a wide
character string if the text is not simple ASCII. The text itself might
come from a file with translations and the user should decide about the
current locale, which determines the translation and therefore also the
external encoding used. In such a situation (and many others) the
functions described here are perfect. If more freedom while performing
the conversion is necessary take a look at the <code>iconv</code> functions
(see <a href="Generic-Charset-Conversion.html#Generic-Charset-Conversion">Generic Charset Conversion</a>).
<ul class="menu">
<li><a accesskey="1" href="Selecting-the-Conversion.html#Selecting-the-Conversion">Selecting the Conversion</a>: Selecting the conversion and its properties.
<li><a accesskey="2" href="Keeping-the-state.html#Keeping-the-state">Keeping the state</a>: Representing the state of the conversion.
<li><a accesskey="3" href="Converting-a-Character.html#Converting-a-Character">Converting a Character</a>: Converting Single Characters.
<li><a accesskey="4" href="Converting-Strings.html#Converting-Strings">Converting Strings</a>: Converting Multibyte and Wide Character
Strings.
<li><a accesskey="5" href="Multibyte-Conversion-Example.html#Multibyte-Conversion-Example">Multibyte Conversion Example</a>: A Complete Multibyte Conversion Example.
</ul>
</body></html>