encode cmd to stdout encoding