fix issue with encoding certain unicode codepoints