Allow alternate encodings when creating a file

Needed for Embark processing
Merge pull request #44 from terrywbrady/master

Allow alternate encodings when creating a file