neverrend / XMLChecker

Cyber Ninjas XML Checker
GNU General Public License v3.0
1 stars 0 forks source link

UnicodeEncodeError: 'charmap' codec can't encode character '\x81' in position 400779: character maps to <undefined> #12

Closed Jnchi closed 4 years ago

Jnchi commented 4 years ago
Traceback (most recent call last):
  File "C:\Users\Jnchi\repos\XMLChecker\XMLCheck.py", line 224, in <module>
    main()
  File "C:\Users\Jnchi\repos\XMLChecker\XMLCheck.py", line 221, in main
    writeToXML(xmlFile, et)
  File "C:\Users\Jnchi\repos\XMLChecker\XMLCheck.py", line 191, in writeToXML
    f.write(xmlString)
  File "C:\Python37\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\x81' in position 400779: character maps to <undefined>
neverrend commented 4 years ago

Fixed in 7c3e6be. Used Read Bytes and UTF-8 when opening/writing to the file.