make backwards compatible with string instead of options to specify encoding