Use binary mode to write encoded files
Merge pull request #17 from sauliusg/encoding_fix

Use binary mode to write encoded files