fix encoding to accept non-ascii characters