Nice library!
The ReadStlFile_ASCII, ReadStlFile_BINARY, and StlFileHasASCIIFormat functions all take const char* for the filename.
On windows this causes issues when opening filenames which contain Unicode (UTF-16) strings.
The issue is the ifstream(const char*) constructor, which on windows will only accept ascii strings.
Possible solutions/ideas:
- Templatize the function on
CharT
- Overload the function on windows only with a version which takes a
const wchar_t* or possibly const char16_t* (this is the easiest to monkey-patch in lieu of a fix)
- (C++17 only) Take a
std::filesystem::path as an argument instead of a const char*, which should do all the conversions for you and just do the right thing on all platforms. Would be backwards compatible, since const char* converts to a path implicitly.
- Have the function take an arbitrary
istream instead of requiring filenames (would support e.g. piping easier this way I guess)
Nice library!
The
ReadStlFile_ASCII,ReadStlFile_BINARY, andStlFileHasASCIIFormatfunctions all takeconst char*for the filename.On windows this causes issues when opening filenames which contain Unicode (UTF-16) strings.
The issue is the
ifstream(const char*)constructor, which on windows will only accept ascii strings.Possible solutions/ideas:
CharTconst wchar_t*or possiblyconst char16_t*(this is the easiest to monkey-patch in lieu of a fix)std::filesystem::pathas an argument instead of aconst char*, which should do all the conversions for you and just do the right thing on all platforms. Would be backwards compatible, sinceconst char*converts to apathimplicitly.istreaminstead of requiring filenames (would support e.g. piping easier this way I guess)