HDFGroup / hdf5

Official HDF5® Library Repository
Other
543 stars 235 forks source link

Regression with 1.14.4-3 H5Fcreate opens and close file with wide chars (example chinese characters) #4599

Open Nelson-numerical-software opened 1 week ago

Nelson-numerical-software commented 1 week ago

Previously with 1.12.1 on windows x64 build, this code works as expected with filename = L'漢字.nh5'

    std::string utf_filename = wstring_to_utf8(filename);
    hid_t plist_id = H5Pcreate(H5P_FILE_CREATE);
    H5Pset_userblock(plist_id, 512);
    hid_t plist_ap = H5Pcreate(H5P_FILE_ACCESS);
#if H5_VERSION_GE(1, 10, 2)
    H5Pset_libver_bounds(plist_ap, H5F_LIBVER_EARLIEST, H5F_LIBVER_V18);
#endif
    hid_t fid = H5Fcreate(utf_filename.c_str(), H5F_ACC_TRUNC, plist_id, plist_ap);
    // fid OK no error
    H5Pclose(plist_id);
    herr_t status = H5Fclose(fid);
    if (status < 0) {
     delete[] header_offset;
     delete[] header_saturated;
     return -1;
    }
   // status OK
  #ifdef _MSC_VER
    FILE* fp = _wfopen(filename.c_str(), L"r+b");
#else
    FILE* fp = fopen(utf_filename.c_str(), "r+b");
#endif
    if (fp == nullptr) {
   // HERE FILE WAS NOT CREATED !!!
    }

file was not created by H5FCreate

What do I miss ?