g-battaglia / kerykeion

Data driven Astrology 💫
Kerykeion is a python library for astrology. It can generate SVG charts and extract all data about a birthchart, a synastry chart and a transit chart.
https://kerykeion.net
GNU Affero General Public License v3.0
316 stars 110 forks source link

change encoding to utf-8 for output file #20

Closed gavrilov closed 2 years ago

gavrilov commented 2 years ago

I encountered an error - the degree symbol (°) was not displayed correctly in the svg file:

XML Parsing Error: not well-formed
Location: file:///KanyeNatalChart.svg
Line Number 16, Column 76:
<text x="20" y="86" style="fill: #000000; font-size: 11px">Latitude: 41￿2.143444,14.821704 C 22.143444,18.116795 22.143444,21.411884 22.143444,24.706975 z " style="fill: #6b3d00;" />

This happens because the encoding in the open function is platform dependent and we need to specify it

  with open(self.chartname, "w", encoding='utf-8') as output_file:
      output_file.write(self.template)
g-battaglia commented 2 years ago

Thank you for your contribution!