From: Sandro Santilli Date: Wed, 27 Jul 2005 02:47:14 +0000 (+0000) Subject: Support for multibyte field names in loader X-Git-Tag: pgis_1_1_0~296 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=433a22c0c60a17082e60b26aecdb051e89f82498;p=postgis Support for multibyte field names in loader git-svn-id: http://svn.osgeo.org/postgis/trunk@1838 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/CHANGES b/CHANGES index 87cdeea79..c31d8e347 100644 --- a/CHANGES +++ b/CHANGES @@ -17,13 +17,14 @@ PostGIS 1.1.0CVS PostGIS 1.0.3 ????/??/?? + - Severe bugfix in lwgeom's 2d bounding box computation - Bugfix in WKT (-w) POINT handling in loader - Bugfix in dumper on 64bit machines - Bugfix in dumper handling of user-defined queries - Bugfix in create_undef.pl script - Small performance improvement in canonical input function - Minor cleanups in loader - - Severe bugfix in lwgeom's 2d bounding box computation + - Support for multibyte field names in loader PostGIS 1.0.2 2005/07/04 diff --git a/loader/shp2pgsql.c b/loader/shp2pgsql.c index ca4e9a997..68e0f2b1f 100644 --- a/loader/shp2pgsql.c +++ b/loader/shp2pgsql.c @@ -1526,6 +1526,9 @@ GetFieldsSpec(void) char name[MAXFIELDNAMELEN]; char name2[MAXFIELDNAMELEN]; DBFFieldType type = -1; +#ifdef USE_ICONV + char *utf8str; +#endif num_fields = DBFGetFieldCount( hDBFHandle ); num_records = DBFGetRecordCount(hDBFHandle); @@ -1546,6 +1549,17 @@ GetFieldsSpec(void) widths[j] = field_width; precisions[j] = field_precision; +#ifdef USE_ICONV + if ( encoding ) + { + utf8str = utf8(encoding, name); + if ( ! utf8str ) exit(1); + strcpy(name, utf8str); + free(utf8str); + } +#endif + + /* * Make field names lowercase unless asked to * keep identifiers case. @@ -1582,7 +1596,7 @@ GetFieldsSpec(void) } } - field_names[j] = malloc ( strlen(name)+3 ); + field_names[j] = malloc (strlen(name)+1); strcpy(field_names[j], name); sprintf(col_names, "%s\"%s\",", col_names, name); @@ -1636,6 +1650,9 @@ utf8 (const char *fromcode, char *inputbuf) /********************************************************************** * $Log$ + * Revision 1.94 2005/07/27 02:47:14 strk + * Support for multibyte field names in loader + * * Revision 1.93 2005/07/27 02:35:50 strk * Minor cleanups in loader *