Attempt to fix issue #10366 encoding and categoricals hdf serialization.
closes #10366 . 

Probably not quite the right approach but want to run travis. Tests are a bit weak at this point (just testing for non-exceptions). Encoding issues might be relevant to other types besides categoricals (but categoricals raise exceptions when strings to mangled to non-uniqueness).
