MSVC offers the codecvt_utf8
locale facet for this problem.
#include <codecvt>
// ...
std::wofstream fout(fileName);
std::locale loc(std::locale::classic(), new std::codecvt_utf8<wchar_t>);
fout.imbue(loc);
More Related Contents:
- Export all symbols when creating a DLL
- Qt5 Static Build yields Failed to load platform plugin “windows”
- How do I input variables using cin without creating a new line?
- When including header files, is the path case sensitive?
- How to print UTF-8 strings to std::cout on Windows?
- Windows Unicode C++ Stream Output Failure
- Fatal error: “No Target Architecture” in Visual Studio
- VC++ fatal error LNK1168: cannot open filename.exe for writing
- Can’t get visual studio C++ include file ‘excpt.h’ to get installed
- Differences between running an executable with Visual Studio debugger vs without debugger
- C++ Reading an unknown number of integers to cin and outputting the sum
- CMD command on c#
- How does the Import Library work? Details?
- Where does Visual Studio look for C++ header files?
- Displaying the #include hierarchy for a C++ file in Visual Studio
- How to read a value from the Windows registry
- How to properly replace global new & delete operators
- Porting clock_gettime to windows
- How to get screenshot of a window as bitmap object in C++?
- Is there a way to automatically avoiding stepping into certain functions in Visual Studio?
- How to read the screen pixels?
- How can I make Visual Studio’s build be very verbose?
- How to make Visual Studio use the native amd64 toolchain
- Clang C++ Cross Compiler – Generating Windows Executable from Mac OS X
- changing the directory from inside a c program under windows using system command
- Get base address of process
- How can CString be passed to format string %s?
- EnumDisplayDevices vs WMI Win32_DesktopMonitor, how to detect active monitors?
- Cannot open include file: ‘stdio.h’ – Visual Studio Community 2017 – C++ Error
- Getting another process command line in Windows