fix(controller+client): utf-8 encode only string types

Fixes #1812.