Closed sayyedaleem closed 3 years ago
Changing line 79 in earthquake.py
to this:
data = input_file.read().encode('utf-8')
should force the file to be sent to InfluxDB with the proper encoding.
I’ve updated the Chapter 06 repo script accordingly
When I am trying to insert Earthquake data into InfluxDB 1.7.2. , I get an error that "ERROR:root:'latin-1' codec can't encode character '\u0101' in position 3702: Body ('ā') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8." Most of the locations in the JSON i.e Pahala has special character 'a' with macron or characters not supported by Latin-1 encoding. How can I get around those special characters when inserting into InfluxDB. I am planning to chart EarthQuake database via Grafana 7.x. How can I modify earthquake.py script to post data as UTF-8 not as Latin-1 as Latin-1 cannot encode special characters in locations like Pahala which contains special character 'a' with macron.