UTF-16の場合、これを同時に読み取ってwchar
に変換することができます。たとえば、Unicode UTF-32ファイルをwstringに読み込みます。
std::wifstream* file = new std::wifstream(name, ifstream::binary);
locale lo = locale(file->getloc(), new std::codecvt_utf16<wchar_t, 0x10ffff, std::little_endian>);
file->imbue(lo);
UTF-32入力の場合、どうすればよいですか?
、あなたは 'のstdを使用することができます:: codecvt_utf16' –
Danh
[STD :: u32string変換の可能性の重複/ std :: stringとstd :: u16string](http://stackoverflow.com/questions/31302506/stdu32string-conversion-to-from-stdstring-and-stdu16string) – Danh
@ダン、おそらくかなり重複 - 私は 'std :: codecvt_utf16'を 'imbue()'に置き換えることができますか? (私は本当に知りません;私は今までにUTF-8が必要です) –