[GIS] pyshp problem with naturalearthdata-shapefile

pyshppython

trying to follow this example:
https://code.google.com/p/pyshp/wiki/ShapeRecords

entering the following code:

import shapefile
r = shapefile.Reader("ne_110m_admin_0_countries")
sr = r.shapeRecords()

gives this error-message under python 3,3 64 bit on windows 7:

Traceback (most recent call last):
  File "D:\stuff\beispiel1.py", line 3, in <module>
    sr = r.shapeRecords()
  File "C:\Python33\lib\site-packages\shapefile.py", line 553, in shapeRecords
    for rec in zip(self.shapes(), self.records())]
  File "C:\Python33\lib\site-packages\shapefile.py", line 525, in records
    r = self.__record()
  File "C:\Python33\lib\site-packages\shapefile.py", line 501, in __record
    value = u(value)
  File "C:\Python33\lib\site-packages\shapefile.py", line 60, in u
    return v.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf4 in position 1: invalid continuation byte

Any ideas, what I am doing wrong (just used another shapefile from www.naturalearthdata.com) ???

UPDATE (May, 8th. 2014)
Today I received an email from the developer of pyshp, Mr. Joel Lawhead. The problem I mentioned was a bug, which only occurs, when you use python vers 3.x . python vers. 2.x was not affected. He kindly send me a patched version, which works fine for me. He also told me, that this new version will be released soon.

Best Answer

Natural Earth data is Windows-1252 encoded, not UTF-8. I suggest seeing if changing the encoding from 'utf-8' to 'windows-1252' at line 60 in shapefile.py helps. If so, send a patch to the pyshp project.