tbeu / matio

MATLAB MAT File I/O Library
https://matio.sourceforge.io
BSD 2-Clause "Simplified" License
334 stars 97 forks source link

UTF-16 encoded filenames #58

Closed cstaub closed 7 years ago

cstaub commented 7 years ago

Is there any way to open file paths that are UTF-16 encoded, e.g. записано.mat? Mat_Open requires const char as input, no way no use const wchar_t or any other solution?

tbeu commented 7 years ago

Wide-character (2-byte "UCS-2") API support was planned for v1.6.0 long time ago. But apart from your request it was never asked for it. It would be a Windows only change, as wchar_t* is a Win type and on Linux you pass UTF-8 (or whatever) encoded strings through a char*. Note, that there also is no wide-character API for the hdf5 library available, which then is the show-stopper for v7.3 (HDF5) MAT files.

emmenlau commented 7 years ago

As far as I could see, the gcc-based builds on Windows also support UTF-8 with basic strings. You could try the MSYS2 build and see if it fixes the issue? There is also hdf5, bzip, zlib and szip in MSYS2, so you should be ready to go.

cstaub commented 7 years ago

thx for the hint, I will give it a try

cstaub commented 7 years ago

I ended up getting the short version of the filename via windows API (GetShortPathNameW) and using that to open the mat file. Works fine.