To reproduce:
-
Run HDFView.
-
Create HDF5 file test.h5.
-
Add attribute “test”. Specify Datatype class as STRING, String Length
7, Value “Привет!”. Not that it’s not possible to specify the UTF-8
encoding (but hopefully HDFView deduces it from the actual string?). -
View attribute value: it is displayed correctly.
-
Run h5dump on the file created. It outputs:
HDF5 "test.h5" {
GROUP "/" {
ATTRIBUTE "test" {
DATATYPE H5T_STRING {
STRSIZE 7;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
DATA {
(0):
"\37777777717\37777777760\37777777750\37777777742\37777777745\37777777762"
}
}
}
}
The data was stored using CSET H5T_CSET_ASCII despite it contains
non-ASCII characters.
Best wishes,
Andrey Paramonov