[FWTools] (no subject)

Frank Warmerdam warmerdam at pobox.com
Tue Oct 21 10:43:59 EDT 2008


David Potts wrote:
> 
> Can the Fwtool toolkit deal with international character sets other than
> standard ascii ?
> 
>  ogr2ogr -f   PostgreSQL PG:"host=127.0.0.1 user=dave dbname=foobar
> port=5434" -nln foobar -append  itant-tpPoints.shp
> Warning 1: Unable to detect single-column primary key for 'foobar'. Use
> default 'ogc_fid'
> Warning 1: Unable to detect single-column primary key for 'foobar'. Use
> default 'ogc_fid'
> ERROR 1: INSERT command for new feature failed.
> ERROR:  invalid byte sequence for encoding "UTF8": 0x91
> HINT:  This error can also happen if the byte sequence does not match the
> encoding expected by the server, which is controlled by "client_encoding".
> 
> Command: INSERT INTO "foobar" (wkb_geometry , "grid_squar", "label",
> "mapnum", "objectid", "symbol", "tpid") VALUES
> (GeomFromEWKT('SRID=32767;POINT (-2.114480000000185
> 47.614519999999175)'::TEXT) , 'C1', '�Duretie�?', '14', 4,
> 'station, known', 690)
> ERROR 1: Terminating translation prematurely after failed
> 
> I would normaly use something like
> 
> shp2pgsql -c -W iso-8859-1
> 
> with the normal postgres tools.  I would prefer to use ogr commands
> because the handel .prj files.

David,

With quite recent versions of OGR you can force the client encoding
using the PGCLIENTENCODING environment variable.  This is touched on
in the online docs at:

   http://www.gdal.org/ogr/drv_pg.html

The latest FWTools for linux or the gdal-dev package in OSGeo4W will
include these changes. I'm not sure whether the changes are in 1.5.x
though.

The desired model for OGR is that each driver translates things to/from
UTF-8 unicode when reading and writing - which is the default action
of the postgres driver now.  However, some OGR drivers - like shape -
do not yet do this which results in non-unicode data getting to the
postgres driver.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the FWTools mailing list