OpenCOLLADA icon indicating copy to clipboard operation
OpenCOLLADA copied to clipboard

Utf-8 encoded filename on Windows

Open aothms opened this issue 8 years ago • 0 comments

  • COLLADABU::NativeString has 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::ofstream is opened by calling c_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

aothms avatar Sep 11 '17 10:09 aothms