[gdal-dev] Are unicode field values supported in the Python bindings for GDAL?

Paolo Corti pcorti at gmail.com
Wed Apr 11 03:38:33 EDT 2012


On Tue, Apr 10, 2012 at 11:49 PM, Roy Hyunjin Han
<starsareblueandfaraway at gmail.com> wrote:
> In GDAL 1.9.0 and Python 2.7.2,
>
>    feature.SetField(0, u'xxx')
>
> raises the following exception
>
>    NotImplementedError: Wrong number of arguments for overloaded
> function 'Feature_SetField'.
>    Possible C/C++ prototypes are:
>        SetField(OGRFeatureShadow *,int,char const *)
>        SetField(OGRFeatureShadow *,char const *,char const *)
>        SetField(OGRFeatureShadow *,int,int)
>        SetField(OGRFeatureShadow *,char const *,int)
>        SetField(OGRFeatureShadow *,int,double)
>        SetField(OGRFeatureShadow *,char const *,double)
>        SetField(OGRFeatureShadow *,int,int,int,int,int,int,int,int)
>        SetField(OGRFeatureShadow *,char const *,int,int,int,int,int,int,int)
>

this will work:
feat.SetField(0, u'xxx'.encode('utf-8'))

p

-- 
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti


More information about the gdal-dev mailing list