boeboe / china-cities

Python package to get the names of Chinese cities and provinces

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 84: character maps to <undefined>

llw2021 opened this issue · comments

Getting an Unicode decoded error when I tried to import the china_cities python. Any advices?

Try encoding='utf-8' in the open method at line 22 of the china_cities/cities.py file

with open(os.path.join(location, 'cities.csv'), encoding='utf-8') as fileHandler:
for line in fileHandler:
split = line.strip().split(",")
CITIES.append(City(name_en=split[0], name_cn=split[1], province=split[2]))

Fixed in 0.0.4 (only python3)