Utf-8 encoded filename on Windows
COLLADABU::NativeStringhas the option to accept a UTF-8 encoded string [1].- This transforms utf-8 to utf-16 to CP_ACP [2]
- Through the StreamWriter constructor the
std::ofstreamis opened by callingc_str()[3]. - On my end this mostly ends up as question marks for characters outside of my native code page.
What is the proper way to open a UTF-8 (or otherwise unicode) file on Windows? There seems to be a way to open a file using wchar_t* [4] which I think is the sanest way to handle unicode files on Windows, although not very portable. But I can't seem to connect it to the StreamWriter which always defaults to char*.
[1] https://github.com/KhronosGroup/OpenCOLLADA/blob/ab61463df4cbe6535c0c0a1560d9b9c67225c55e/COLLADABaseUtils/include/COLLADABUNativeString.h#L34 [2] https://github.com/KhronosGroup/OpenCOLLADA/blob/ab61463df4cbe6535c0c0a1560d9b9c67225c55e/COLLADABaseUtils/src/COLLADABUNativeString.cpp#L46 [3] https://github.com/KhronosGroup/OpenCOLLADA/blob/ab61463df4cbe6535c0c0a1560d9b9c67225c55e/COLLADAStreamWriter/src/COLLADASWStreamWriter.cpp#L69 [4] https://github.com/KhronosGroup/OpenCOLLADA/blob/ab61463df4cbe6535c0c0a1560d9b9c67225c55e/common/libBuffer/include/CommonFWriteBufferFlusher.h#L84