Set UTF-8 encoding on non-binary file open & close to fix issue #131.