[gdal-dev] Does OGRLayer::CreateField() suport UNICODE in ver1.4.1 ?

Frank Warmerdam warmerdam at pobox.com
Tue Aug 19 15:20:26 EDT 2008

wow wrote:
> Hi, When i call OGRLayer::CreateField() to create a field with a Chinese 
> name[UNICODE], i got errors. The driver is ESRI shape. Does 
> OGRLayer::CreateField() suport UNICODE in ver1.4.1 ?

Chen Xuexia,

The Shapefile driver has not been updated to be encoding aware at all.  The
zero terminated string passed as the field name is truncated to 11 (10?) bytes
and used directly in the .dbf file with no attempts at translation.

The DBF format has a couple mechanisms for identifying encoding - OGR ignores
them all.  A good fix for this would be desirable.  The intent of RFC 23
(http://trac.osgeo.org/gdal/wiki/rfc23_ogr_unicode) is that field values,
and presumably field and layer names should be treated as UTF-8 strings.  But
only a few format drivers actual do anything about this.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the gdal-dev mailing list