# Problems when using hdf5 on non English windows

**URL:** <https://forum.hdfgroup.org/t/problems-when-using-hdf5-on-non-english-windows/3283>\
**Category:** Hdf-forum archives\
**Created:** [August 4, 2014, 12:33pm UTC](https://forum.hdfgroup.org/t/problems-when-using-hdf5-on-non-english-windows/3283 "2014-08-04T12:33:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cazador](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@cazador](https://forum.hdfgroup.org/u/cazador)\
**Post date:** [August 4, 2014, 12:33pm UTC](https://forum.hdfgroup.org/t/problems-when-using-hdf5-on-non-english-windows/3283/1 "2014-08-04T12:33:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Stohr\_Alexander](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/s/cdc98d/32.png) [@Stohr\_Alexander](https://forum.hdfgroup.org/u/Stohr_Alexander)\
**Post date:** [August 4, 2014, 1:10pm UTC](https://forum.hdfgroup.org/t/problems-when-using-hdf5-on-non-english-windows/3283/2 "2014-08-04T13:10:14Z")

</div>

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:

&nbsp;&nbsp;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](mailto:Alexander.Stohr@HDLE.com)  
Web: [www.hdle.com](http://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](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](mailto: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](mailto:Hdf-forum@lists.hdfgroup.org)  
> [http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum\_lists.hdfgroup.org](http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org)  
> Twitter: [https://twitter.com/hdf5](https://twitter.com/hdf5)

---

<div class="post-metadata">

**Author:** ![cazador](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@cazador](https://forum.hdfgroup.org/u/cazador)\
**Post date:** [August 5, 2014, 6:57am UTC](https://forum.hdfgroup.org/t/problems-when-using-hdf5-on-non-english-windows/3283/3 "2014-08-05T06:57:30Z")

</div>

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)  
{  
&nbsp;&nbsp;&nbsp;&nbsp;int fd = -1;  
&nbsp;&nbsp;&nbsp;&nbsp;int name\_len = strlen(name);  
&nbsp;&nbsp;&nbsp;&nbsp;wchar\_t\* wname = (wchar\_t\*)malloc( sizeof(wchar\_t)\*(name\_len + 1) );  
&nbsp;&nbsp;&nbsp;&nbsp;MultiByteToWideChar( CP\_UTF8, 0, name, -1, wname, name\_len + 1 );  
&nbsp;&nbsp;&nbsp;&nbsp;fd=\_wopen(wname, oflag, pmode);  
&nbsp;&nbsp;&nbsp;&nbsp;free(wname);  
&nbsp;&nbsp;&nbsp;&nbsp;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:
> > 
> > &nbsp;&nbsp;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](http://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](http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org)  
> > Twitter: [x.com](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](http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org)  
> > Twitter: [x.com](https://twitter.com/hdf5)

---

<div class="post-metadata">

**Author:** ![cazador](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@cazador](https://forum.hdfgroup.org/u/cazador)\
**Post date:** [August 12, 2014, 7:36am UTC](https://forum.hdfgroup.org/t/problems-when-using-hdf5-on-non-english-windows/3283/4 "2014-08-12T07:36:08Z")

</div>

Are nobody have any ideas or possibilities to my problem ?
