Add option to control encoding of messages