@@ -2064,7 +2064,7 @@ def is_land(self,xpt,ypt):
2064
2064
2065
2065
def readshapefile (self ,shapefile ,name ,drawbounds = True ,zorder = None ,
2066
2066
linewidth = 0.5 ,color = 'k' ,antialiased = 1 ,ax = None ,
2067
- default_encoding = 'utf-8' ):
2067
+ default_encoding = 'utf-8' , encoding_errors = 'strict' ):
2068
2068
"""
2069
2069
Read in shape file, optionally draw boundaries on map.
2070
2070
@@ -2117,6 +2117,10 @@ def readshapefile(self,shapefile,name,drawbounds=True,zorder=None,
2117
2117
antialiased antialiasing switch for shape boundaries
2118
2118
(default True).
2119
2119
ax axes instance (overrides default axes instance)
2120
+ default_encoding encoding used to parse properties from .dbf files
2121
+ (default utf-8)
2122
+ encoding_errors encoding error handling (default strict), other
2123
+ possible values: ignore, replace and backslashreplace
2120
2124
============== ====================================================
2121
2125
2122
2126
A tuple (num_shapes, type, min, max) containing shape file info
@@ -2140,7 +2144,8 @@ def readshapefile(self,shapefile,name,drawbounds=True,zorder=None,
2140
2144
# open shapefile, read vertices for each object, convert
2141
2145
# to map projection coordinates (only works for 2D shape types).
2142
2146
try :
2143
- shf = Reader (shapefile , encoding = default_encoding )
2147
+ shf = Reader (shapefile , encoding = default_encoding ,
2148
+ encodingErrors = encoding_errors )
2144
2149
except :
2145
2150
raise IOError ('error reading shapefile %s.shp' % shapefile )
2146
2151
fields = shf .fields
0 commit comments