fix for issue #1: bug with encoding, add default encoding