Encoding non-ascii characters to xmlcharrefs