Fixed read function file encoding in open