encode the output