escape non-ascii characters to be safe, fixes #40