Problems when using hdf5 on non English windows

Our app uses internally HDF5 library. Problem occurs when client uses non english windows - in example japan version.
When he choose to save / load file at path with special characters in filename like in example some special folder with japanese-like words, whole operation fails.
Is there any solution for such cases ?
Thanks for any help.

Regards,
Artur

I am assuming you are using a Win32 platform that is capable of e.g. Unicode file names.

This is one of the core file-io APIs of HDF5:

  hid_t H5Fopen( const char *name, unsigned flags, hid_t fapl_id )

As you can see the file name here is encoded in ASCII characters
with probably some of the extended 8 bit characters still valid.

This means you can _not_ use any Unicode characters in such a case.

A probably simple and thus nice work-around would be:

* for read: determine the file name using Win32 functions and then derive its 8.3 variant from that for using it in the H5Fopen command.
* for write: create the file using a temporary name. close the file using H5F api and then rename the file to what you want using the win32 api.

Best regards

Alexander Stohr
Algorithm Developer

HDLE - Halla DAS Lab Europe GmbH

Schomburger Strasse 9, 88279 Amtzell, Germany
Tel:+49 7520 2024 800
Mail: Alexander.Stohr@HDLE.com
Web: www.hdle.com

Managing Directors: Dr. Seok Cheol Kee, Andrea Weuffen, Wolfgang Vieweger

···

-----Ursprüngliche Nachricht-----
Von: Hdf-forum [mailto:hdf-forum-bounces@lists.hdfgroup.org] Im Auftrag von arturkolacz@ortosoft.eu
Gesendet: Montag, 4. August 2014 14:34
An: hdf-forum@lists.hdfgroup.org
Betreff: [Hdf-forum] Problems when using hdf5 on non English windows

Our app uses internally HDF5 library. Problem occurs when client uses non english windows - in example japan version.
When he choose to save / load file at path with special characters in filename like in example some special folder with japanese-like words, whole operation fails.
Is there any solution for such cases ?
Thanks for any help.

Regards,
Artur

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Thanks for your answer. Your assumption is right - we are using Win32 platform. For this moment we use nice work-around that is small path to hdf library and which looks like this :
H5FDwindows.c

int win_open_patched(const char *name, int oflag, int pmode)
{
    int fd = -1;
    int name_len = strlen(name);
    wchar_t* wname = (wchar_t*)malloc( sizeof(wchar_t)*(name_len + 1) );
    MultiByteToWideChar( CP_UTF8, 0, name, -1, wname, name_len + 1 );
    fd=_wopen(wname, oflag, pmode);
    free(wname);
    return fd;
}

H5win32defs.h
//#define HDopen(S,F,M) _open(S,F|_O_BINARY,M)
int win_open_patched(const char *name, int oflag, int pmode);
#define HDopen(S,F,M) win_open_patched(S,F|_O_BINARY,M)

Yet using this patch force to rewriting it after any hdf library update to newer version.
When it comes to use temporary name in still brings some issues as this day when Windows 7 and 8 uses UAC it is hard to find some good temporary place to store temporary file and which won`t have any russian cyrilic or japanese characters in path. Path like - Users/ ... - still can have japan user name and other common folders can be write protected. It would be nice if library gave alternative to use wide char filepath. Arent`t there any chance to add such functionality ?

Regards,
Artur

···

----- Original Message -----
From: "Stohr, Alexander" <Alexander.Stohr@HDLE.com>
To: HDF Users Discussion List <hdf-forum@lists.hdfgroup.org>
Date: Mon, 4 Aug 2014 13:10:14 +0000
Subject: Re: [Hdf-forum] Problems when using hdf5 on non English windows

I am assuming you are using a Win32 platform that is capable of e.g. Unicode file names.

This is one of the core file-io APIs of HDF5:

  hid_t H5Fopen( const char *name, unsigned flags, hid_t fapl_id )

As you can see the file name here is encoded in ASCII characters
with probably some of the extended 8 bit characters still valid.

This means you can _not_ use any Unicode characters in such a case.

A probably simple and thus nice work-around would be:

* for read: determine the file name using Win32 functions and then derive its 8.3 variant from that for using it in the H5Fopen command.
* for write: create the file using a temporary name. close the file using H5F api and then rename the file to what you want using the win32 api.

Best regards

Alexander Stohr
Algorithm Developer

HDLE - Halla DAS Lab Europe GmbH

Schomburger Strasse 9, 88279 Amtzell, Germany
Tel:+49 7520 2024 800
Mail: Alexander.Stohr@HDLE.com
Web: www.hdle.com

Managing Directors: Dr. Seok Cheol Kee, Andrea Weuffen, Wolfgang Vieweger

-----Ursprüngliche Nachricht-----
Von: Hdf-forum [mailto:hdf-forum-bounces@lists.hdfgroup.org] Im Auftrag von arturkolacz@ortosoft.eu
Gesendet: Montag, 4. August 2014 14:34
An: hdf-forum@lists.hdfgroup.org
Betreff: [Hdf-forum] Problems when using hdf5 on non English windows

Our app uses internally HDF5 library. Problem occurs when client uses non english windows - in example japan version.
When he choose to save / load file at path with special characters in filename like in example some special folder with japanese-like words, whole operation fails.
Is there any solution for such cases ?
Thanks for any help.

Regards,
Artur

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Are nobody have any ideas or possibilities to my problem ?