Add infrastructure to keep character encoding with a FILE*.
This is an attempt to be able to read/write Unicode text while
maintaining a reasonable amount of backward-compatability.
A lot more work is needed to make the file API compatible with Unicode.