]> granicus.if.org Git - postgis/commitdiff
Support for multibyte field names in loader
authorSandro Santilli <strk@keybit.net>
Wed, 27 Jul 2005 02:47:14 +0000 (02:47 +0000)
committerSandro Santilli <strk@keybit.net>
Wed, 27 Jul 2005 02:47:14 +0000 (02:47 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@1838 b70326c6-7e19-0410-871a-916f4a2858ee

CHANGES
loader/shp2pgsql.c

diff --git a/CHANGES b/CHANGES
index 87cdeea7901389b7055bbdc19f6f9cd425603638..c31d8e3477411f8d556a942dc8b7b5a0e71c0700 100644 (file)
--- 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
index ca4e9a99745b776101b524ca3647184846a1c7c2..68e0f2b1f7d75e12a98d93992add726200ca836d 100644 (file)
@@ -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
  *