google-code-export / alembic

Automatically exported from code.google.com/p/alembic
0 stars 0 forks source link

On Windows opening a file with arbitrary unicode characters is impossible. #303

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
To open an archive on Windows you need to convert the file name to the current 
code page. This breaks if the current code page can't encode all characters in 
the file name.

This seems to be a limitation in the HDF5 back-end.

I'm using Alembic 1.1.3 on Windows 7.

Original issue reported on code.google.com by roeland....@gmail.com on 27 Feb 2013 at 12:47

GoogleCodeExporter commented 9 years ago
Unfortunately there doesn't appear to be a portable solution:

http://stackoverflow.com/questions/821873/how-to-open-an-stdfstream-ofstream-or-
ifstream-with-a-unicode-filename

This should be a problem with both the HDF5 and Ogawa back end.

However, with Ogawa you can work around this by providing a custom stream class 
for reading and writing.

If you have any other hints on a portable solution, I'd love to hear it.

Original comment by miller.lucas on 24 Sep 2013 at 5:05

GoogleCodeExporter commented 9 years ago
On Windows all functions for opening a file by name, like fopen, or _open, or 
the std::ifstream constructor, have a version which takes the file name as a 
const wchar_t*, using UTF-16 encoding. So for Ogawa there is no problem: you 
can create a std::ifstream using a wchar_t* string as file name and open the 
Alembic file using this stream.

The problem is in the HDF5 library, it eventually uses the _open() function, 
which assumes the file name is encoded in the current code page. I don't think 
it is possible to work around this without modifying HDF5.

Original comment by roeland....@gmail.com on 3 Dec 2013 at 11:11