encode post before submitting