Hi Phil, On Apr 26, 2011, at 2:58 PM, Kraus Philipp wrote:
> > Am 26.04.2011 um 15:34 schrieb Quincey Koziol: > >> Hi all, >> >> On Apr 26, 2011, at 6:12 AM, Kraus Philipp wrote: >> >>> >>> Am 26.04.2011 um 12:52 schrieb Jens Thoms Toerring: >>>>> It seems that my code create 2 bytes for the ä, ö, ü, ß and Matlab 1 byte. >>>>> Can I switch the encoding in the HDF5 file or can I use unicode or >>>>> anything >>>>> else? >>>> >>>> Don't know if you can get MatLab to use UTF-8, concerning the >>>> HDF5 file the question is how it is written. The program it's >>>> written by seems to use UTF-8. Can you change that? If this >>>> is a test program with the 'äöüß' hard-coded into it you just >>>> may have to get your editor to use ISO-8859-1. Writing to the >>>> HDF5 file isn't the point, it just contains what you told it >>>> to, the problem is passing in the values you want it to con- >>>> tain. >>> >>> I've tested the code with ISO-8859-1 (change my source code, because the >>> chars are hardcoded), than the encoding is correct (C++ & Matlab). But my >>> problem I read XML data with utf-8 encoding (some cyrillic chars, etc). I >>> would like to write them to the HDF and read them into Matlab. Do you have >>> any idea with a correct encoding? >>> >>> If I read / write the char data in my code, I can set the correct encoding >>> representation, but is there an option for saving the encoding into the >>> file, because only the char code isn't unique. I can set utf-8, utf-8, >>> ASCII, etc >> >> Would the H5Tset_cset() routine >> (http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetCset) help out >> here? > > Thanks, but if I use this call: > > H5::StrType l_str(0, p_strlen+1); > l_str.setCset( H5T_CSET_UTF8 ); > > the dump of a file shows: > DATATYPE H5T_STRING { > STRSIZE 29; > STRPAD H5T_STR_NULLTERM; > CSET H5T_CSET_ASCII; > CTYPE H5T_C_S1; > } > > No exception is thrown or something else. It seems, that the string object > does not set the H5T_CSET_UTF8 Hmm, does the same thing happen with a simple program in C? (I'm looking to determine if the error is in the C++ wrapper, or possibly in the h5dump tool) Thanks, Quincey
_______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
