Author xiang.zhang
Recipients aimad, benjamin.peterson, ezio.melotti, lemburg, serhiy.storchaka, vstinner, xiang.zhang
Date 2017-04-30.14:28:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1493562531.66.0.94494842519.issue30195@psf.upfronthosting.co.za>
In-reply-to
Content
IMHO this doesn't look like an error in xml library. With a little tweak in of your problem: adding encoding declaration, removing not needed imports, replace open with codecs.open(encoding='utf8') in create_report, the C problem works fine for me:

[tmp]$ cat essai_rapport_test_30-04-2017-22-22_你好.xml
<?xml version="1.0" ?>
<rapport_test date="2017-04-30" langue="你好" nb_correcte="你好" nb_incorrecte="abc" time="22:22:46"/>

xml_file.write(doc.toprettyxml()) fails for me since ascii codecs cannot encode the result of doc.toprettyxml, a unicode. And I would suggest you adding failure checks to your C program. Almost every step could fail and then result in a segfault.
History
Date User Action Args
2017-04-30 14:28:51xiang.zhangsetrecipients: + xiang.zhang, lemburg, vstinner, benjamin.peterson, ezio.melotti, serhiy.storchaka, aimad
2017-04-30 14:28:51xiang.zhangsetmessageid: <1493562531.66.0.94494842519.issue30195@psf.upfronthosting.co.za>
2017-04-30 14:28:51xiang.zhanglinkissue30195 messages
2017-04-30 14:28:51xiang.zhangcreate