Support Unicode for file contents

Fixes #1 by adding an `encoding` knob (default UTF-8) and encoding to bytestring on write if necessary.