Fix generate string to not need to call encode

The subject describes this PR