[postgis-users] re: shp2sql and UTF8 question on Windows

strk at refractions.net strk at refractions.net
Thu Jan 26 04:07:40 PST 2006


On Thu, Jan 26, 2006 at 11:55:44AM +0100, Markus Schaber wrote:

> I would not say stat my "solution" is better than using iconv, I'd say
> the opposite. It is inferior in at least three points:
> 
> - It supports less input encodings (iconv has much more than postgres)
> 
> - It fails to load e. G. a LATIN-1 data into a LATIN-9 database because
> postgres does not support conversion between those charsets.
> 
> - It will never work with non-ASCII compatible encodings like EBCDIC or
> UTF-16 (even when support is added to the server) as the surrounding SQL
> commands are always output in ASCII.

The main problem was strings not being properly escaped.
This brought IIDA Tetsushi to send out a patch.

Talking with pgsql guys I come to using UTF8 middle-encoding
to ensure quotes and backslashes (in the lower 7bits) would
have been correctly hanlded.

For background info, see:
http://postgis.refractions.net/pipermail/postgis-devel/2005-January/000798.html


> My patch just is a cleaner way of the bash magic we used to set the
> client_encoding header earlier, before shp2pgsql supported iconv.
>
> It was meant as a light-weight solution for those people who have a
> shp2psql build without iconv for whatever reason.

Would setting PGOPTIONS work ?

./shp2pgsql ... | PGOPTIONS="-c client_encoding=EBCDIC" psql

--strk;

 +----------------------------------------+
 | Fight against software patents in EU!  |
 | www.ffii.org www.nosoftwarepatents.org |
 +----------------------------------------+



More information about the postgis-users mailing list