[postgis-users] problem with apostrophe

Andreas Neumann neumann at karto.baug.ethz.ch
Mon Jan 15 07:25:04 PST 2007


Michael Fuhr wrote:

>On Mon, Jan 15, 2007 at 03:29:47PM +0100, Andreas Neumann wrote:
>  
>
>>When I run "psql -f data.sql -d mydb" I get the following error message:
>>
>>=========
>>
>>psql:hydrography.sql:6302: WARNING:  nonstandard use of \' in a string 
>>literal
>>    
>>
>
>This isn't an error; it's a warning.  The data should have loaded --
>did it?
>  
>

of course - you are right. It loaded just fine.

>PostgreSQL 8.1 and later have an escape_string_warning configuration
>variable that controls these warnings.  In 8.1 the default configuration
>is "off"; in 8.2 the default is "on".
>
>  
>
>>How do I correctly format such a string containing apostrophes? Is there 
>>an option for shp2pgsql to correctly handle the apostrophs in text 
>>strings when converting from ESRI shapefiles? Or do I need to choose a 
>>certain encoding (-W)?
>>    
>>
>
>You could use -D, which emits COPY statements instead of INSERTs,
>or you could set escape_string_warning to off while loading data.
>  
>

thank you for the hint. I used the -D option which works just fine now.

Do you have an idea how I can find out what encoding my shapefile uses? 
In the Postgis DB I use UTF-8, but my shapefile doesn't seem to use 
UTF-8. At least it fails if I use UTF-8 as an encoding during conversion 
process. I have no idea how to find out what encoding the shapefile 
uses. I used ISO-8859-1 during conversion. It seems to work fine, but it 
is just a guess encoding that I use now.

Thanks,
Andreas

-- 
----------------------------------------------
Andreas Neumann
Institute of Cartography
ETH Zurich
Wolfgang-Paulistrasse 15
CH-8093  Zurich, Switzerland

Phone: ++41-44-633 3031, Fax: ++41-44-633 1153
e-mail: neumann at karto.baug.ethz.ch
www: http://www.carto.net/neumann/
SVG.Open: http://www.svgopen.org/
Carto.net: http://www.carto.net/




More information about the postgis-users mailing list