Skip to content

Commit

Permalink
loading json as utf8
Browse files Browse the repository at this point in the history
  • Loading branch information
rm-Umar committed Nov 23, 2022
1 parent c0927b7 commit 7bd6df2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions ipinfo/handler_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,11 @@ def read_coords(location):


def read_json_file(json_file):
"""
Read a list of countries from specified country file or default file.
"""
json_file = os.path.join(os.path.dirname(__file__), json_file)
with open(json_file) as f:
countries_json = f.read()
with open(json_file, encoding="utf8") as f:
json_data = f.read()

return json.loads(countries_json)
return json.loads(json_data)


def return_or_fail(raise_on_fail, e, v):
Expand Down

0 comments on commit 7bd6df2

Please # to comment.