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

Mark Cave-Ayland m.cave-ayland at webbased.co.uk
Mon Apr 10 15:22:12 PDT 2006


> -----Original Message-----
> From: Randy George [mailto:rkgeorge at cadmaps.com]
> Sent: Monday, April 10, 2006 9:32 AM
> To: 'PostGIS Users Discussion'
> Subject: RE: [postgis-users] Win32 testers required: shp2pgsql with -W
> encodingswitch
> 
> 
> 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 >
> test.sql
> 
> 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:
> http://www.census.gov/geo/cob/bdy/co/co00shp/co72_d00_shp.zip
> 
> Reviewing the PostgreSQL8.1 doc
> http://www.postgresql.org/docs/8.1/interactive/multibyte.html#CHARSET-
> TABLE
> 
> I tried changing from -W Cp1252 to -W WIN1252:
> 
> D:\Demographics\co_county>"E:\Program
> 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
> 
> randy


Hi Randy,

Thanks for the pointer to the shapefile. I've done some more testing at this
end, and I believe that the problem you are seeing is not related to
libiconv-2.dll as I see exactly the same error message on a fresh Linux
install as well as Windows. The complete list of encodings is given in the
iconv documentation
(http://www.gnu.org/software/libiconv/documentation/libiconv/iconv_open.3.ht
ml). I had a look around the www.census.gov website and unfortunately it
doesn't give any information about the encoding of the provided shapefiles
:(

Since this is reproducible on Linux as well as Windows, I'm inclined to say
that it's an encoding mismatch rather than a Windows build error. However I
notice in your original post that you managed to use a Java program to do
the conversion for you. Unfortunately I'm not the world's greatest expert
when it comes to locales and encodings - can anyone else help out here?


Kind regards,

Mark.

------------------------
WebBased Ltd
17 Research Way
Plymouth
PL6 8BT

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

http://www.webbased.co.uk   
http://www.infomapper.com
http://www.swtc.co.uk  

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
person.





More information about the postgis-users mailing list