I'm using hdf5 to store data acquired from spectrometer and now encountering problem with UTF-8 filenames.
String name = "数据.h5";
IHDF5Writer writer = HDF5Factory.open(name);
writer.string().write("file_name", name);
writer.close();
That would create 2 file in current folder: 数据.h5 (0 KB) and 鏁版嵁.h5 (3 KB)
Then I use the flowing codes to retrieve data:
final IHDF5Reader reader = HDF5Factory.openForReading(name);
final String strName = reader.string().read("file_name");
reader.close();
System.out.println("name = " + strName);
That would output: name = ??.h5
I used HDFView 2.13 (downloaded from HDF Group website) to open 数据.h5, it opened successfully. But I tried to open 鏁版嵁.h5, it failed.
If I wrote the hdf5 file with name "data.h5" and then rename it to "数据.h5" and then openned with HDFView, it alse failed.
If I copied data.h5 to another folder which the folder path contained unicode charaters, HDFView also failed to open the new copied data.h5. It threw exception when I used sis-jhdf5 to open the new copied data.h5:
Exception in thread "main" ncsa.hdf.hdf5lib.exceptions.HDF5FileInterfaceException: File accessibilty:Unable to open file ["..\..\src\H5FDsec2.c line 339 in H5FD_sec2_open(): unable to open file: name = 'D:\数据\data.h5'
I digged the web and found this was an old issue:
HDF Group also noted this issue but had no plan to fix it:
I'm hesitate to use hdf5 continuously or change to other file store strategy such H2 database.
Any suggestions would be welcome.
Best regards,
Trig Chen