Changed the methods for opening and saving files to support unicode properly.