Description
When I read a shapefile by using “readshapefile”, the error “UnicodeDecodeError” happened,like this:
“UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc8 in position 0: invalid continuation byte”
I realized the encoding type of the shapefile isn’t “utf-8”, so I read the documentation of Basemap.
Here: https://matplotlib.org/basemap/api/basemap_api.html
readshapefile(shapefile, name, drawbounds=True, zorder=None, linewidth=0.5, color='k', antialiased=1, ax=None, default_encoding='utf-8')
Then I found the parameter “default_encoding=’utf-8’”, so I changed this parameter as “default_encoding=’ANSI’”. But the error didn’t change, still “UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc8 in position 0: invalid continuation byte”.
So, this is the problem: I already changed the parameter, if the encoding type of the shapefile isn’t “ANSI”, the error should be “UnicodeDecodeError: 'mbcs' codec can't decode bytes in position 0—1” instead of “utf-8”.
So is the parameter “default_encoding=’utf-8’” fixed? I can’t change the parameter??