From e60f4fe990e7aae7d15a1b0eab1e924fde83ba69 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Wed, 27 Jul 2005 02:47:06 +0000 Subject: [PATCH] Support for multibyte field names in loader git-svn-id: http://svn.osgeo.org/postgis/branches/pgis_1_0@1837 b70326c6-7e19-0410-871a-916f4a2858ee --- CHANGES | 3 ++- loader/shp2pgsql.c | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index b0f5766f5..0b841e098 100644 --- a/CHANGES +++ b/CHANGES @@ -1,12 +1,13 @@ 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 b583e1d18..81da08c5b 100644 --- a/loader/shp2pgsql.c +++ b/loader/shp2pgsql.c @@ -1521,6 +1521,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); @@ -1541,6 +1544,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. @@ -1577,7 +1591,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); @@ -1633,6 +1647,9 @@ utf8 (const char *fromcode, char *inputbuf) /********************************************************************** * $Log$ + * Revision 1.88.2.5 2005/07/27 02:47:06 strk + * Support for multibyte field names in loader + * * Revision 1.88.2.4 2005/07/27 02:34:29 strk * Minor cleanups in loader * -- 2.40.0