encode support two optional params