encode headers