fstream :: open () Unicode или не-Ascii символы не работают (с std :: ios :: out) в Windows

В проекте C ++ я хочу открыть файл (fstream::open()) (что, кажется, является серьезной проблемой). Сборка Windows моей программы с треском провалилась.

File "ä" (UTF-8 0xC3 0xA4)

<code>std::string s = ...;
//Convert s
std::fstream f;
f.open(s.c_str(), std::ios::binary | std::ios::in); //Works (f.is_open() == true)
f.close();
f.open(s.c_str(), std::ios::binary | std::ios::in | std::ios::out); //Doesn't work
</code>

The string s is UTF-8 encoded, but then converted from UTF-8 to Latin1 (0xE4). I'm using Qt, so QString::fromUtf8(s.c_str()).toLocal8Bit().constData().

Why can I open the file for reading, but not for writing?

File "и" (UTF-8 0xD0 0xB8)

Same code, doesn't work at all.

Кажется, этот символ не подходит для кодировки Windows-1252. Как я могу открыть такой fstream (я не использую MSVC, поэтомунетfstream::open(const wchar_t*, ios_base::openmode))?

Ответы на вопрос(2)

Ваш ответ на вопрос