[postgis-users] Win32 testers required: shp2pgsql with -Wencodingswitch

Mark Cave-Ayland m.cave-ayland at webbased.co.uk
Tue Apr 11 01:14:36 PDT 2006

> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-
> bounces at postgis.refractions.net] On Behalf Of Mark Cave-Ayland
> Sent: 10 April 2006 23:22
> To: 'Randy George'; 'PostGIS Users Discussion'
> Subject: RE: [postgis-users] Win32 testers required: shp2pgsql with -
> Wencodingswitch

(I wrote)

> Since this is reproducible on Linux as well as Windows, I'm inclined to
> 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?

I've had a closer look at the source DBF file using hexdump (and added a few
debugging statements) and AFAICT looking at the accented characters the
shapefiles are not encoded in CP1252 but in CP437. So the following should
work for you:

"E:\Program Files\PostgreSQL\8.1\bin\shp2pgsql.exe" -W CP437 -D 
 -s4269 -k -d D:\Demographics\co_county\co72_d00_shp\co72_d00.shp 
 public.pr_county > test.sql

I'm still having some trouble trying to get the data to display correctly in
psql.exe; for example if I do:

	Start -> Run -> cmd.exe
	chcp 1252
	psql -d test
	set client_encoding to win1252;
	select "NAME" from pr_county;

...then psql.exe still doesn't display it correctly. However, pgAdmin III
handles it without any problems so my guess is that this is a psql.exe
specific problem - you'd probably have to bring this up on the pgsql lists
if want to find out the specifics.

Kind regards,


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

More information about the postgis-users mailing list