Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/locale/codecvt utf8 utf16"

From cppreference.com
< cpp‎ | locale
(simplified example)
m (explicit inheritance)
Line 7: Line 7:
 
           unsigned long Maxcode = 0x10ffff,
 
           unsigned long Maxcode = 0x10ffff,
 
           std::codecvt_mode Mode = (std::codecvt_mode)0 >
 
           std::codecvt_mode Mode = (std::codecvt_mode)0 >
class codecvt_utf8_utf16;
+
class codecvt_utf8_utf16 : public std::codecvt<Elem, char, std::mbstate_t>;
 
}}
 
}}
 
{{ddcl list end}}
 
{{ddcl list end}}

Revision as of 06:05, 4 November 2011

Template:cpp/locale/sidebar Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <codecvt>
</td>

<td></td> <td></td> </tr> <tr class="t-dcl ">

<td class="t-dcl-nopad">
template< class Elem,

          unsigned long Maxcode = 0x10ffff,
          std::codecvt_mode Mode = (std::codecvt_mode)0 >

class codecvt_utf8_utf16 : public std::codecvt<Elem, char, std::mbstate_t>;
</td>

<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end

Template:cpp is a Template:cpp facet which encapsulates conversion between a UTF-8 encoded byte string and UTF-16 encoded character string. If Elem is a 32-bit type, one UTF-16 codepoint will be stored in each 32-bit character of the output sequence. This codecvt facet can be used to read and write UTF-8 files, both text and binary.

Template Parameters

Elem - either Template:cpp, Template:cpp, or Template:cpp
Maxcode - the largest value of Elem that this facet will read or write without error
Mode - a constant of type Template:cpp

Example

Template:example cpp

See also

Character
conversions
locale-defined multibyte
(UTF-8, GB18030)
UTF-8
UTF-16
UTF-16 mbrtoc16 / c16rtomb (with C11's DR488)

codecvt<char16_t,char,mbstate_t>
codecvt_utf8_utf16<char16_t>
codecvt_utf8_utf16<char32_t>
codecvt_utf8_utf16<wchar_t>

N/A
UCS-2 c16rtomb (without C11's DR488) codecvt_utf8<char16_t> codecvt_utf16<char16_t>
UTF-32

mbrtoc32 / c32rtomb

codecvt<char32_t,char,mbstate_t>
codecvt_utf8<char32_t>

codecvt_utf16<char32_t>

system wchar_t:

UTF-32 (non-Windows)
UCS-2 (Windows)

mbsrtowcs / wcsrtombs
use_facet<codecvt
<wchar_t,char,mbstate_t>>(locale)

codecvt_utf8<wchar_t> codecvt_utf16<wchar_t>
Template:cpp/locale/dcl list codecvtTemplate:cpp/locale/dcl list codecvt modeTemplate:cpp/locale/dcl list codecvt utf8Template:cpp/locale/dcl list codecvt utf16