[postgis-users] Tools to change the encoding of the SHP/DBF files (from Latin1 to UTF-8)

Sandro Santilli strk at keybit.net
Tue May 8 06:13:26 PDT 2012


On Tue, May 08, 2012 at 02:56:28PM +0200, Mac Wind wrote:
> Hi.
> 
> Using PostGIS 1.5 on Windows, I get this error message when trying to
> import a SHP:
> ----------------
> Unable to convert data value to UTF-8 (iconv reports "Invalid argument").
> Current encoding is "UTF-8". Try "LATIN1" (Western European), or one of the
> values described at
> http://www.postgresql.org/docs/current/static/multibyte.html.
> ----------------
> 
> Really my data are in Latin1 encoding, but I don't want to change the
> encoding of the DataBase into Latin1, but change the encoding of the SHP
> (in fact, of the DBF) into UTF-8.
> 
> Which tool could I use to do this? Thank you very much.

You don't have to change DB encoding, just tell the loader that your
data is in Latin1:

 $ shp2pgsql -W Latin1 ...

--strk;

  ,------o-. 
  |   __/  |    Delivering high quality PostGIS 2.0 !
  |  / 2.0 |    http://strk.keybit.net - http://vizzuality.com
  `-o------'




More information about the postgis-users mailing list