Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch NC_CHAR on netCDF4 to use ASCII #316

Merged
merged 1 commit into from
Mar 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/file_format_specifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ data are written). In that case the specified endian type will be used
in HDF5 (for example, a H5T_STD_I16LE will be used for NC_SHORT, if
little-endian has been specified for that variable.)
- NC_BYTE = H5T_NATIVE_SCHAR
- NC_UBYTE = H5T_NATIVE_SCHAR
- NC_UBYTE = H5T_NATIVE_UCHAR
- NC_CHAR = H5T_C_S1
- NC_STRING = variable length array of H5T_C_S1
- NC_SHORT = H5T_NATIVE_SHORT
Expand Down
2 changes: 1 addition & 1 deletion libsrc4/nc4hdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ nc4_get_hdf_typeid(NC_HDF5_FILE_INFO_T *h5, nc_type xtype,
return NC_EHDFERR;
if (H5Tset_strpad(typeid, H5T_STR_NULLTERM) < 0)
BAIL(NC_EVARMETA);
if(H5Tset_cset(typeid, H5T_CSET_UTF8) < 0)
if(H5Tset_cset(typeid, H5T_CSET_ASCII) < 0)
BAIL(NC_EVARMETA);

/* Take ownership of the newly created HDF5 datatype */
Expand Down
5 changes: 3 additions & 2 deletions nc_test4/tst_strings2.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ main(int argc, char **argv)
int ncid, i;
char *data_in[ATT_LEN];
char *data[ATT_LEN] = {"An appeaser is one who feeds a crocodile — "
"hoping it will eat him last."};

"hoping it will eat him last. "
"Here are some non-ASCII characters: "
"\x00\xAA\xBB\xFF"};

if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
if (nc_put_att(ncid, NC_GLOBAL, ATT_NAME, NC_STRING, ATT_LEN, data)) ERR;
Expand Down