more encode tests, fix encoding K string value bug