add better encode support in encryption and output