encoding for writeFile