encode the form