{"action":"opened","issue":{"url":"https://api.github.com/repos/frejanordsiek/hdf5storage/issues/24","labels_url":"https://api.github.com/repos/frejanordsiek/hdf5storage/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/frejanordsiek/hdf5storage/issues/24/comments","events_url":"https://api.github.com/repos/frejanordsiek/hdf5storage/issues/24/events","html_url":"https://github.com/frejanordsiek/hdf5storage/issues/24","id":105940235,"number":24,"title":"Add support for dict keys of other string types (bytes, numpy.bytes_, numpy.unicode_)","user":{"login":"frejanordsiek","id":5252219,"avatar_url":"https://avatars.githubusercontent.com/u/5252219?v=3","gravatar_id":"","url":"https://api.github.com/users/frejanordsiek","html_url":"https://github.com/frejanordsiek","followers_url":"https://api.github.com/users/frejanordsiek/followers","following_url":"https://api.github.com/users/frejanordsiek/following{/other_user}","gists_url":"https://api.github.com/users/frejanordsiek/gists{/gist_id}","starred_url":"https://api.github.com/users/frejanordsiek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frejanordsiek/subscriptions","organizations_url":"https://api.github.com/users/frejanordsiek/orgs","repos_url":"https://api.github.com/users/frejanordsiek/repos","events_url":"https://api.github.com/users/frejanordsiek/events{/privacy}","received_events_url":"https://api.github.com/users/frejanordsiek/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/frejanordsiek/hdf5storage/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-11T03:47:20Z","updated_at":"2015-09-11T03:47:20Z","closed_at":null,"body":"At present (version 0.1.9), only ``dict`` with keys that are entirely unicode strings (``str`` in Python 3.x and ``unicode`` in Python 2.x) can be written to an HDF5 file.\r\n\r\nThe simplest way to add support for the other string types is to, if all keys are string types, convert them all to ``str`` in Python 3.x or ``unicode`` in Python 2.x, write them to disk like before, and then use an HDF5 Attribute to specify which kind of string type each one is. A reasonable way to do it would be to use a single string with a single character designating each one and have them be in the same order as the ``'Python.Fields'`` and ``'MATLAB_fields'`` Attributes. Re-using the numpy dtype characters for the numpy ones is a good idea. Perhaps\r\n\r\nType | Character\r\n---- | ---------\r\nbytes | ``'b'``\r\nstr | ``'t'``\r\nnumpy.bytes_ | ``'S'``\r\nnumpy.unicode_ | ``'U'``"}}