Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


  >  Docs Center  >  IDL Reference  >  I/O - HDF5  >  H5T_SET_CSET

H5T_SET_CSET

H5T_SET_CSET

The H5T_SET_CSET procedure sets the encoding type of a string datatype for a dataset or attribute. The H5T_GET_CSET function can be used to retrieve the encoding type.

Note: The default encoding type for strings is ASCII. Call H5T_SET_CSET only for UTF-8 encoding.

Note: Call H5T_SET_CSET before you create the dataset or attribute.

Example


fid = H5F_CREATE("myfile.h5")
datatype_id = H5T_IDL_CREATE("very long string")
H5T_SET_CSET, datatype_id, /UTF8
dataspace_id = H5S_CREATE_SIMPLE([1])
dataset_id = H5D_CREATE(fid, 'dataset', $
  datatype_id, dataspace_id)
H5D_WRITE, dataset_id, "my data string"
H5F_CLOSE, fid
 
fid = H5F_OPEN("myfile.h5")
dataset_id = H5D_OPEN(fid, 'dataset')
datatype_id = H5D_GET_TYPE(dataset_id)
PRINT, H5T_GET_CSET(datatype_id)
H5F_CLOSE, fid

IDL prints:

UTF8

Syntax


H5T_SET_CSET, Datatype_id [, /ASCII] [, /UTF8]

Arguments


Datatype_id

An integer representing the datatype's identifier to be queried.

Keywords


ASCII

Set this keyword to force the encoding type to US ASCII. This is the default behavior if no keywords are set.

UTF8

Set this keyword to force the encoding type to UTF-8.

Version History


8.6.1

Introduced

See Also


H5T_GET_CSET, H5T_IDL_CREATE



© 2018 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us