Fixes encoding for write/readAsText