write encoding