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

Randy George rkgeorge at cadmaps.com
Mon Jan 23 16:04:59 PST 2006


Hi,

	Thanks for the tip.

	I ended up using the encoding parameter from Java.io FileInputStream
and FileOutputStream to translate from the server's default system encoding
Cp1252 to Utf8. I think that does the same thing as the gnu gettext.

BufferedReader fromCp1252 = new BufferedReader(
new InputStreamReader(new FileInputStream("test.sql"), "Cp1252"));

PrintWriter toUTF8 = new PrintWriter(
new OutputStreamWriter(new FileOutputStream("test_utf8.sql"), "UTF8")); 

Perhaps a future postgis-pg81-setup-1.1.1-1.exe could build the shp2sql with
the -W switch enabled.

thanks

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Armin
Burger
Sent: Monday, January 23, 2006 2:54 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] re: shp2sql and UTF8 question on Windows

Maybe the support for iconv was not compiled into the Windows binaries. 
You could try run iconv on the SQL file before loading it. An iconv.exe 
for Windows is available at

ftp://ftp.gnu.org/gnu/libiconv/libiconv-1.9.1.bin.woe32.zip
(you need also 
ftp://ftp.gnu.org/gnu/gettext/gettext-runtime-0.13.1.bin.woe32.zip)

Armin


Randy George wrote:
> Hi,
> 
>  
> 
> I am using postgresql-8.1.2-1 with PostGIS 1.1.1 on a Windows 2003 OS 
> installed using the installer from http://www.webbased.co.uk/mca/
> 
>  
> 
> I have a database created with ENCODING = 'UTF8'
> 
>  
> 
> I am then using the shp2sql translator to create a table from a shp file 
> with a municipio named Manat¡
> 
> ¡ = hex A1
> 
>  
> 
> When I attempt to load the resulting sql file into the table I get this 
> error:
> 
>  
> 
> psql:test.sql:15: ERROR:  invalid UTF-8 byte sequence detected near byte 
> 0xa1
> 
> CONTEXT:  COPY county, line 1, column NAME: "Manatí"
> 
> ROLLBACK
> 
>  
> 
> When I try to use the –W parameter I get this message:
> 
> WARNING: the -W switch will have no effect. UTF8 disabled at compile time
> 
>  
> 
> Is there a way to get around this?
> 
>  
> 
> Thanks
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list