SchrodingersGat / KiBoM

Configurable BoM generation tool for KiCad EDA (http://kicad.org/)
MIT License
352 stars 95 forks source link

Fixed utf-8 bug in the XML writer. #129

Closed gbmhunter closed 3 years ago

gbmhunter commented 3 years ago

I noticed than non-ASCII characters (e.g. ± with component tolerances) were getting destroyed when generating an .xml BOM. The fix was to specify the encoding when calling toprettyxml(), and then call .decode('utf-8') to get the bytes back into a Python string suitable to output.write().

Oh and sorry about my previous pull-request that used f-strings, I didn't realize Python 2 was supported. I then noticed that KiCAD for Windows is still bundled with Python 2 :-).

SchrodingersGat commented 3 years ago

@gbmhunter thanks for the fix, character encoding is such a pain! Cheers

gbmhunter commented 3 years ago

@SchrodingersGat thanks back at ya for the quick response and merge!