Skip to content

Commit 7bd6df2

Browse files
committed
loading json as utf8
1 parent c0927b7 commit 7bd6df2

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

ipinfo/handler_utils.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,11 @@ def read_coords(location):
9999

100100

101101
def read_json_file(json_file):
102-
"""
103-
Read a list of countries from specified country file or default file.
104-
"""
105102
json_file = os.path.join(os.path.dirname(__file__), json_file)
106-
with open(json_file) as f:
107-
countries_json = f.read()
103+
with open(json_file, encoding="utf8") as f:
104+
json_data = f.read()
108105

109-
return json.loads(countries_json)
106+
return json.loads(json_data)
110107

111108

112109
def return_or_fail(raise_on_fail, e, v):

0 commit comments

Comments
 (0)