Kaydet (Commit) 546412e6 authored tarafından Claude Paroz's avatar Claude Paroz

Fixed #28495 -- Converted GDAL Feature.fields to strings

üst 41640760
......@@ -82,8 +82,13 @@ class Feature(GDALBase):
@property
def fields(self):
"Return a list of fields in the Feature."
return [capi.get_field_name(capi.get_field_defn(self._layer._ldefn, i))
for i in range(self.num_fields)]
return [
force_text(
capi.get_field_name(capi.get_field_defn(self._layer._ldefn, i)),
self.encoding,
strings_only=True
) for i in range(self.num_fields)
]
@property
def geom(self):
......
......@@ -195,6 +195,7 @@ class DataSourceTest(unittest.TestCase):
# Making sure we get the proper OGR Field instance, using
# a string value index for the feature.
self.assertIsInstance(feat[k], v)
self.assertIsInstance(feat.fields[0], str)
# Testing Feature.__iter__
for fld in feat:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment