std::codecvt_mode
提供:cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Defined in header <locale>
|
||
| enum codecvt_mode { consume_header = 4, |
||
ファセットstd::codecvt_utf8、std::codecvt_utf16、そしてstd::codecvt_utf8_utf16ユニコード文字列変換のオプション機能を指定するテンプレート引数として型std::codecvt_modeの任意の値を受け入れ.
Original:
The facets std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16 accept an optional value of type std::codecvt_mode as a template argument, which specifies optional features of the unicode string conversion.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[編集] 定数
| Defined in header
<locale> | |
| 値
Original: Value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Meaning |
little_endian
|
入力はリトルエンディアンのバイト順序(のみ、デフォルトはビッグエンディアンのUTF-16の入力に適用されます)であると仮定します
Original: assume the input is in little-endian byte order (applies to UTF-16 input only, the default is big-endian) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
consume_header
|
入力シーケンスの開始時に存在して、(UTF-16の場合)の場合、バイトオーダーマークを消費し、復号化するため、それが指定するバイトオーダー入力の残りの部分に依存しています
Original: consume the byte order mark, if present at the start of input sequence, and (in case of UTF-16), rely on the byte order it specifies for decoding the rest of the input The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
generate_header
|
出力シーケンスの先頭にバイトオーダーマークを出力する
Original: output the byte order mark at the start of the output sequence The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
認識バイト順マークは、次のとおりです
Original:
The recognized byte order marks are:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
0xfe 0xff
|
UTF-16ビッグエンディアン
Original: UTF-16 big-endian The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
0xff 0xfe
|
UTF-16のリトルエンディアン
Original: UTF-16 little-endian The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
0xef 0xbb 0xbf
|
UTF-8(エンディアンへの影響はありません)
Original: UTF-8 (no effect on endianness) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
BOM(Byte Order Mark)で始まるファイルを読み込むときstd::consume_headerが選択されていない場合は、Unicode文字U + FEFF(ZERO WIDTH改行なしスペース)は、文字列の内容の最初の文字のように読むことができます.
Original:
If std::consume_header is not selected when reading a file beginning with byte order mark, the Unicode character U+FEFF (Zero width non-breaking space) will be read as the first character of the string content.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[編集] 例
次の例では、UTF-8のBOMを消費して示しています
Original:
The following example demonstrates consuming the UTF-8 BOM
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
#include <fstream> #include <iostream> #include <string> #include <locale> #include <codecvt> int main() { // UTF-8 data with BOM std::ofstream("text.txt") << u8"\ufeffz\u6c34\U0001d10b"; // read the UTF8 file, skipping the BOM std::wifstream fin("text.txt"); fin.imbue(std::locale(fin.getloc(), new std::codecvt_utf8<wchar_t, 0x10ffff, std::consume_header>)); for(wchar_t c; fin.get(c); ) std::cout << std::hex << std::showbase << c << '\n'; }
Output:
0x7a 0x6c34 0x1d10b
[編集] も参照してください
| UTF-8、UTF-16、UTF-32を含む文字エンコーディング間の変換を行います Original: converts between character encodings, including UTF-8, UTF-16, UTF-32 The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (クラステンプレート) | |
| (C++11) |
UTF-8とUCS2/UCS4の間で変換を行います Original: converts between UTF-8 and UCS2/UCS4 The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (クラステンプレート) |
| (C++11) |
UTF-16とUCS2/UCS4の間で変換を行います Original: converts between UTF-16 and UCS2/UCS4 The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (クラステンプレート) |
| (C++11) |
converts between UTF-8 and UTF-16 (クラステンプレート) |