Support encoding changing. Caller may choose the encodings for reading and saving the file.