Sets character set to be used in a string or character datatype


H5T_SET_CSET (dtype_id, cset)


<pre><code class="language-c">herr_t H5Tset_cset( hid_t dtype_id, H5T_cset_t cset )</code></pre>

<pre><code class="language-fortran">SUBROUTINE h5tset_cset_f(type_id, cset, hdferr) 
  INTEGER(HID_T), INTENT(IN) :: type_id 
                                  ! Datatype identifier 
  INTEGER, INTENT(IN) :: cset     ! Character set type of a string datatype  
                                  ! Possible values are:
                                  !    H5T_CSET_ASCII_F = 0
                                  !    H5T_CSET_UTF8_F = 1
  INTEGER, INTENT(OUT) :: hdferr  ! Error code
END SUBROUTINE h5tset_cset_f</code></pre>

hid_t dtype_idIN: Identifier of datatype to modify
H5T_cset_t cset    IN: Character set type


 H5T_SET_CSET sets the character set to be used in a dataset with a string or character datatype.

Valid values for cset include the following:

H5T_CSET_ASCIICharacter set is US ASCII
H5T_CSET_UTF8Character set is UTF-8, enabling UTF-8 Unicode encoding

For example, if the character set for the datatype dtype_id is set to H5T_CSET_UTF8, string or character data of datatype dtype_id will be encoded using the UTF-8 Unicode character set.

ASCII and UTF-8 Unicode are the only currently supported character encodings. Extended ASCII encodings (for example, ISO 8859) are not supported. This encoding policy is not enforced by the HDF5 library. Using encodings other than ASCII and UTF-8 can lead to compatibility and usability problems.

Note that H5T_SET_CSET  sets the character set for a character or string datatype while H5P_SET_CHAR_ENCODING  sets the character set used for an HDF5 link or attribute name.


Returns a non-negative value if successful; otherwise returns a negative value.


Coming Soon!

Release    Change
1.8.0UTF-8 Unicode encoding introduced in this release.