important: XMLWriter expects UTF-8 data from you. It can output xml in various encodings, but input should be strictly utf-8!