k666 dites non à petitmou | salut,
j'ai un doc texte que je veux convertir en xml. j'utilise minidom, mais j'ai dans ce texte des caractères moches à savoir "ã". j'aimerais donc specifier qu'il s'agit d'un xml de sortie encode en ISO-8859-1, donc j'utilise :
return myDoc.toxml('iso-8859-1')
mais ca me pond une erreur
Code :
- ************************** TXTFILE **************************
- ./income/000701c70efd$5630c520$0600080a@thinkpadpato/in/nstdec_99999000003200619.nst/99999000003200619.nst.txt
- Exception in thread Thread-1:
- Traceback (most recent call last):
- File "C:\Python24\lib\threading.py", line 442, in __bootstrap
- self.run()
- File "iaNistConv.py", line 96, in run
- self.checkJobs()
- File "iaNistConv.py", line 131, in checkJobs
- xml_file = self.convertToXml(txt_file)
- File "iaNistConv.py", line 190, in convertToXml
- output_xml = my_xml.dumpAsXml()
- File "iaNistConv.py", line 69, in dumpAsXml
- return myDoc.toxml('iso-8859-1')
- File "C:\Python24\Lib\site-packages\_xmlplus\dom\minidom.py", line 47, in toxml
- return self.toprettyxml("", "", encoding)
- File "C:\Python24\Lib\site-packages\_xmlplus\dom\minidom.py", line 59, in toprettyxml
- self.writexml(writer, "", indent, newl, encoding)
- File "C:\Python24\Lib\site-packages\_xmlplus\dom\minidom.py", line 1746, in writexml
- node.writexml(writer, indent, addindent, newl)
- File "C:\Python24\Lib\site-packages\_xmlplus\dom\minidom.py", line 821, in writexml
- node.writexml(writer,indent+addindent,addindent,newl)
- File "C:\Python24\Lib\site-packages\_xmlplus\dom\minidom.py", line 821, in writexml
- node.writexml(writer,indent+addindent,addindent,newl)
- File "C:\Python24\Lib\site-packages\_xmlplus\dom\minidom.py", line 821, in writexml
- node.writexml(writer,indent+addindent,addindent,newl)
- File "C:\Python24\Lib\site-packages\_xmlplus\dom\minidom.py", line 816, in writexml
- _write_data(writer, attrs[a_name].value)
- File "C:\Python24\Lib\site-packages\_xmlplus\dom\minidom.py", line 306, in _write_data
- writer.write(data)
- File "C:\Python24\lib\codecs.py", line 178, in write
- data, consumed = self.encode(object, self.errors)
- UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 6: ordinal not in range(128)
- c:\IAFIS BRASIL\DEV>
|
help si qulequ'un a une idee ? |