fix encoding of userids, names, and keys