Difference between revisions of "cpp/locale/codecvt utf8 utf16"
From cppreference.com
(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
</td>
<codecvt>
<td></td> <td></td> </tr> <tr class="t-dcl ">
<td class="t-dcl-nopad">template< class Elem,
</td>
unsigned long Maxcode = 0x10ffff,
std::codecvt_mode Mode = (std::codecvt_mode)0 >
<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end
This section is incomplete Reason: inheritance diagram |
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
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> |
N/A |
UCS-2 | c16rtomb (without C11's DR488) | codecvt_utf8<char16_t> | codecvt_utf16<char16_t> |
UTF-32 |
codecvt<char32_t,char,mbstate_t> |
codecvt_utf16<char32_t> | |
system wchar_t:
UTF-32 (non-Windows) |
mbsrtowcs / wcsrtombs |
codecvt_utf8<wchar_t> | codecvt_utf16<wchar_t> |