Changeset 5098
- Timestamp:
- 01/03/10 21:47:04 (2 years ago)
- Location:
- trunk/loader
- Files:
-
- 3 modified
-
shp2pgsql-cli.c (modified) (2 diffs)
-
shp2pgsql-core.c (modified) (11 diffs)
-
shp2pgsql-core.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/loader/shp2pgsql-cli.c
r5040 r5098 40 40 printf(" -I Create a spatial index on the geocolumn.\n"); 41 41 printf(" -S Generate simple geometries instead of MULTI geometries.\n"); 42 #ifdef HAVE_ICONV43 42 printf(" -W <encoding> Specify the character encoding of Shape's\n"); 44 43 printf(" attribute column. (default : \"ASCII\")\n"); 45 #endif46 44 printf(" -N <policy> NULL geometries handling policy (insert*,skip,abort)\n"); 47 45 printf(" -n Only import DBF file.\n"); … … 140 138 141 139 case 'W': 142 #ifdef HAVE_ICONV143 140 config->encoding = optarg; 144 #else145 fprintf(stderr, "WARNING: the -W switch will have no effect. UTF8 disabled at compile time\n");146 #endif147 141 break; 148 142 -
trunk/loader/shp2pgsql-core.c
r5090 r5098 41 41 */ 42 42 43 #ifdef HAVE_ICONV44 43 char *utf8(const char *fromcode, char *inputbuf); 45 #endif46 44 void vasbappend(stringbuffer_t *sb, char *fmt, ... ); 47 45 char *escape_copy_string(char *str); … … 78 76 } 79 77 80 81 #ifdef HAVE_ICONV82 78 /* Return allocated string containing UTF8 string converted from encoding fromcode */ 83 79 char * … … 112 108 return outputbuf; 113 109 } 114 #endif115 116 110 117 111 /** … … 895 889 char name2[MAXFIELDNAMELEN]; 896 890 DBFFieldType type = -1; 897 #ifdef HAVE_ICONV898 891 char *utf8str; 899 #endif900 892 901 893 /* If we are reading the entire shapefile, open it */ … … 1150 1142 state->precisions[j] = field_precision; 1151 1143 1152 #ifdef HAVE_ICONV1153 1144 if (state->config->encoding) 1154 1145 { … … 1164 1155 free(utf8str); 1165 1156 } 1166 #endif1167 1157 1168 1158 /* … … 1242 1232 stringbuffer_clear(sb); 1243 1233 1244 #ifdef HAVE_ICONV1245 1234 /* Set the client encoding if required */ 1246 1235 if (state->config->encoding) … … 1248 1237 vasbappend(sb, "SET CLIENT_ENCODING TO UTF8;\n"); 1249 1238 } 1250 #endif1251 1239 1252 1240 /* Use SQL-standard string escaping rather than PostgreSQL standard */ … … 1473 1461 char *escval; 1474 1462 char *geometry, *ret; 1475 #ifdef HAVE_ICONV1476 1463 char *utf8str; 1477 #endif1478 1464 int res, i; 1479 1465 … … 1583 1569 } 1584 1570 1585 #ifdef HAVE_ICONV1586 1571 if (state->config->encoding) 1587 1572 { … … 1597 1582 free(utf8str); 1598 1583 } 1599 #endif1600 1584 1601 1585 /* Escape attribute correctly according to dump format */ -
trunk/loader/shp2pgsql-core.h
r5063 r5098 21 21 #include <sys/types.h> 22 22 #include <sys/stat.h> 23 #include <iconv.h> 23 24 24 25 #include "shapefil.h" … … 26 27 27 28 #include "../liblwgeom/liblwgeom.h" 28 29 #ifdef HAVE_ICONV30 #include <iconv.h>31 #endif32 29 33 30 #include "stringbuffer.h"
