{"action":"opened","issue":{"url":"https://api.github.com/repos/h5py/h5py/issues/727","repository_url":"https://api.github.com/repos/h5py/h5py","labels_url":"https://api.github.com/repos/h5py/h5py/issues/727/labels{/name}","comments_url":"https://api.github.com/repos/h5py/h5py/issues/727/comments","events_url":"https://api.github.com/repos/h5py/h5py/issues/727/events","html_url":"https://github.com/h5py/h5py/issues/727","id":162906721,"number":727,"title":"Writing a string does not include NULL terminator","user":{"login":"Flamefire","id":309017,"avatar_url":"https://avatars.githubusercontent.com/u/309017?v=3","gravatar_id":"","url":"https://api.github.com/users/Flamefire","html_url":"https://github.com/Flamefire","followers_url":"https://api.github.com/users/Flamefire/followers","following_url":"https://api.github.com/users/Flamefire/following{/other_user}","gists_url":"https://api.github.com/users/Flamefire/gists{/gist_id}","starred_url":"https://api.github.com/users/Flamefire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Flamefire/subscriptions","organizations_url":"https://api.github.com/users/Flamefire/orgs","repos_url":"https://api.github.com/users/Flamefire/repos","events_url":"https://api.github.com/users/Flamefire/events{/privacy}","received_events_url":"https://api.github.com/users/Flamefire/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-06-29T11:54:17Z","updated_at":"2016-06-29T11:54:17Z","closed_at":null,"body":"When writing a string, the size set in the HDF5Type does not include the terminating NULL although this is required according to HDF5: `String or character datatypes: The size set for a string datatype should include space for the null-terminator character, otherwise it will not be stored on (or retrieved from) disk` [Datatype-SetSize](https://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetSize)\r\n\r\nExample:\r\n\r\n    import h5py\r\n    import numpy\r\n    f=h5py.File(\"test.h5\")\r\n    f.attrs[\"fooStr\"] = numpy.string_(\"1234\")\r\n    f.close()\r\n\r\nbash:\r\n\r\n    h5dump test.h5\r\n\r\n>>HDF5 \"test.h5\" {\r\nGROUP \"/\" {\r\n   ATTRIBUTE \"fooStr\" {\r\n      DATATYPE  H5T_STRING {\r\n         STRSIZE 4;\r\n         STRPAD H5T_STR_NULLPAD;\r\n         CSET H5T_CSET_ASCII;\r\n         CTYPE H5T_C_S1;\r\n      }\r\n      DATASPACE  SCALAR\r\n      DATA {\r\n      (0): \"1234\"\r\n      }\r\n   }\r\n}\r\n\r\nExpected:\r\n\r\n>> HDF5 \"test.h5\" {\r\nGROUP \"/\" {\r\n   ATTRIBUTE \"fooStr\" {\r\n      DATATYPE  H5T_STRING {\r\n         STRSIZE 5;\r\n         STRPAD H5T_STR_NULLPAD;\r\n         CSET H5T_CSET_ASCII;\r\n         CTYPE H5T_C_S1;\r\n      }\r\n      DATASPACE  SCALAR\r\n      DATA {\r\n      (0): \"1234\"\r\n      }\r\n   }\r\n}\r\n"}}
{"actor":{"display_login":"Flamefire"}}