[postgis-users] Win32 testers required: shp2pgsql with -W encodingswitch

Randy George rkgeorge at cadmaps.com
Mon Apr 10 08:32:01 PDT 2006

-----Original Message-----
From: Randy George [mailto:rkgeorge at cadmaps.com] 
Sent: Monday, April 10, 2006 9:30 AM
To: 'PostGIS Users Discussion'
Subject: RE: [postgis-users] Win32 testers required: shp2pgsql with -W

Hi Mark,

	 I downloaded the new shp2pgsql.zip and unzipped into
E:\Program Files\PostgreSQL\8.1\bin

	I then tried it on census Puerto Rico data like this:
"E:\Program Files\PostgreSQL\8.1\bin\shp2pgsql.exe" -W Cp1252 -D -s4269 -k
-d D:\Demographics\co_county\co72_d00_shp\co72_d00.shp public.pr_county >

Which gave the following error:

Shapefile type: Polygon
Postgis type: MULTIPOLYGON[2]
utf8: Illegal byte sequence
I verified that the libiconv-2.dll is in my PostgreSQL\8.1\bin directory.

By the way, the census data set sample can be found here:

Reviewing the PostgreSQL8.1 doc

I tried changing from -W Cp1252 to -W WIN1252:

Files\PostgreSQL\8.1\bin\shp2pgsql.exe" -W
 WIN1252 -D -s4269 -k -d D:\Demographics\co_county\co72_d00_shp\co72_d00.shp
public.pr_county > test.sql
Shapefile type: Polygon
Postgis type: MULTIPOLYGON[2]
utf8: iconv_open: Invalid argument

Thanks for your help


-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Mark
Sent: Monday, April 10, 2006 3:14 AM
To: 'PostGIS Users Discussion'
Subject: [postgis-users] Win32 testers required: shp2pgsql with -W

Hi everyone,

I'm currently in the middle of rewriting the build system I use to produce
the Win32 EXE installers for the 1.1.2 release, and I've managed to devise a
patch that will allow shp2pgsql to compile with the -W (encoding) switch
available under Win32 (see this thread here for more information

AFAICT the patch works and I can specify an encoding on the command line,
however I don't have a comprehensive set of shapefiles in different
encodings to fully test this. Therefore I was hoping that some of the people
in the above thread could help by downloading a test binary from the URL
below and making sure that it all works as it should.

The binary is a replacement for shp2pgsql.exe supplied with PostGIS 1.1.1;
I'd recommend that you rename the old version before extracting the ZIP file
so that it is possible to revert to the original version. Testing under both
the PG 8.0 and 8.1 installers would be very helpful.


Note that with this patch, shp2pgsql.exe now has a dependency on
libiconv-2.dll - fortunately we do not currently need to distribute this
extra DLL since the official PostgreSQL installer automatically places it in
the Windows System directory. As usual, please direct any feedback towards
the lists.

Many thanks,


WebBased Ltd
17 Research Way

T: +44 (0)1752 797131
F: +44 (0)1752 791023


This email and any attachments are confidential to the intended recipient
and may also be privileged. If you are not the intended recipient please
delete it from your system and notify the sender. You should not copy it or
use it for any purpose nor disclose or distribute its contents to any other

postgis-users mailing list
postgis-users at postgis.refractions.net

More information about the postgis-users mailing list