[postgis-users] Problem with shp2pgsql - charachter encoding

Mark Cave-Ayland m.cave-ayland at webbased.co.uk
Fri May 19 07:04:57 PDT 2006


> From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Steven
De Vriendt
> Sent: 19 May 2006 13:16
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Problem with shp2pgsql - charachter encoding
>
> Mark,
> 
> Yes, I'm using that version.
> The shp2pgsql is running fine, the problem comes when importing the
sql-file in the 
> PostGIS database with the psql command. psql returns a message: Invalid
UTF-8 byte 
> sequence detected....so I assumed that something went wrong during the
shp2pgsql 
> excution. I've now converted the resulting sql-file in a UTF-8 encoding
using the save 
> as option in...notepad. Running the pgsql commando then went fine. 
> When displaying my data in Udig I see that some attribute fields aren''t
display 
> correct. Geometry is fine. f.i. 9880 in an attribute field is displayed as
9880.0000000 
> though I don't know what has caused that.
>
> Can you tell me something more about the W-switch and how to use it ?
 

Hi Steven,

The version of PostGIS supplied with the PostgreSQL 8.1.3 Win32 installer
doesn't contain support for the -W switch so you'll need to either upgrade
to PostGIS 1.1.2 or you may have some luck with my original test compile
here: http://www.webbased.co.uk/mca/tmp/shp2pgsql.zip. You should make a
backup of your existing shp2pgsql.exe and copy this one in its place
instead.

For more information about the -W switch you may find this thread useful:
http://postgis.refractions.net/pipermail/postgis-users/2006-April/011756.htm
l and the list of encodings you can pass into the -W switch can be found in
the iconv documentation here:
http://www.gnu.org/software/libiconv/documentation/libiconv/iconv_open.3.htm
l. As a quick starting point, PostgreSQL knows that your database is UNICODE
and so you need to specify the encoding of your shapefile to the -W switch -
you may need to use an ASCII chart and a hexdump of your shapefile in order
to determine which encoding is used in your shapefile.

Finally, please try and post in plain text rather than HTML - a lot of very
knowledgeable people on this list don't use mail clients that will read HTML
and so you're much more likely to get a response.


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