Python3 compat for text / binary types.
Fixed the DictSerializer as well as some encoding.