Xiang Zhang added the comment:

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.

----------
nosy: +xiang.zhang
status: open -> pending

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30195>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to