<div dir="ltr"><div><div>Maybe you could try to expressely set it to corresponding <pre><span class="">iso-8859-1 = LATIN1</span></pre>(instead of latin1)<br></div>or maybe IBM850.<br><br></div><div>If you are on windows, you can just donwload previous version to try with older binaries.<br>
<br></div>Cheers,<br><br>Rémi-C<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-02-07 Michael Fricker <span dir="ltr"><<a href="mailto:michael.fricker@altusgroup.com" target="_blank">michael.fricker@altusgroup.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<u></u>
<u></u>
<u></u>
<u></u>
<u></u>
<u></u>
<u></u>
<div link="blue" vlink="#606420" lang="EN-US">
<div>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt">Hello. I’ve run into a problem with shp2pgsql, at the command
prompt, where the –W option to change the default character encoding of
UTF-8 to, for example LATIN1, is not working. If I’m correct, the
–W character encoding option should allow you to switch from the default
UTF-8 to any other character encode that is required. In my case it is LATIN1.
I used the following line below to store the .sql file.<u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt">shp2pgsql.exe -d -s 2956:3401 -I -W "LATIN1"
"C:\0\Canada_Land_Survey_Data\test\Deliverables\CLSR_Land_Parcel.shp"
scratch.ab_clsr_land_parcel >
C:\0\Canada_Land_Survey_Data\Data_Dump\Land_Parcel_Error.sql<u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt">A portion of the result is shown below. <u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font color="blue" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:blue">SET</span></font> CLIENT_ENCODING <font color="blue"><span style="color:blue">TO</span></font> UTF8;<u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:blue">SET</span></font>
STANDARD_CONFORMING_STRINGS <font color="blue"><span style="color:blue">TO ON</span></font>;<u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:blue">SELECT</span></font> DropGeometryColumn(<font color="#993366"><span style="color:#993366">'scratch','ab_clsr_land_parcel','geom'</span></font>);<u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:blue">DROP TABLE</span></font> <font color="#993366"><span style="color:#993366">"scratch"."ab_clsr_land_parcel"</span></font>;<u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:blue">BEGIN</span></font>;<u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:blue">CREATE TABLE</span></font> <font color="#993366"><span style="color:#993366">"scratch"."ab_clsr_land_parcel"</span></font>
(gid serial,<u></u><u></u></p>
<p class="MsoNormal"><font color="#993366" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:#993366">"pin"</span></font> float8,<u></u><u></u></p>
<p class="MsoNormal"><font color="#993366" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:#993366">"designator"</span></font> <font color="blue"><span style="color:blue">varchar</span></font>(<font color="#00ccff"><span style="color:#00ccff">254</span></font>),<u></u><u></u></p>
<p class="MsoNormal"><font color="#993366" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:#993366">"remain_ind"</span></font> <font color="blue"><span style="color:blue">varchar</span></font>(<font color="#00ccff"><span style="color:#00ccff">254</span></font>),<u></u><u></u></p>
<p class="MsoNormal"><font color="#993366" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:#993366">"planno"</span></font> <font color="blue"><span style="color:blue">varchar</span></font>(<font color="#00ccff"><span style="color:#00ccff">30</span></font>),<u></u><u></u></p>
<p class="MsoNormal"><font color="#993366" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:#993366">"admin_code"</span></font> <font color="blue"><span style="color:blue">varchar</span></font>(<font color="#00ccff"><span style="color:#00ccff">20</span></font>),<u></u><u></u></p>
<p class="MsoNormal"><font color="#993366" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:#993366">"pcl_type"</span></font> <font color="blue"><span style="color:blue">varchar</span></font>(<font color="#00ccff"><span style="color:#00ccff">254</span></font>),<u></u><u></u></p>
<p class="MsoNormal"><font color="#993366" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:#993366">"lcselectio"</span></font> <font color="blue"><span style="color:blue">varchar</span></font>(<font color="#00ccff"><span style="color:#00ccff">100</span></font>),<u></u><u></u></p>
<p class="MsoNormal"><font color="#993366" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:#993366">"remarks"</span></font> <font color="blue"><span style="color:blue">varchar</span></font>(<font color="#00ccff"><span style="color:#00ccff">254</span></font>),<u></u><u></u></p>
<p class="MsoNormal"><font color="#993366" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:#993366">"pcl_state"</span></font> <font color="blue"><span style="color:blue">varchar</span></font>(<font color="#00ccff"><span style="color:#00ccff">254</span></font>),<u></u><u></u></p>
<p class="MsoNormal"><font color="#993366" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:#993366">"reg_pin"</span></font> <font color="blue"><span style="color:blue">varchar</span></font>(<font color="#00ccff"><span style="color:#00ccff">254</span></font>));<u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:blue">ALTER TABLE</span></font> <font color="#993366"><span style="color:#993366">"scratch"."ab_clsr_land_parcel"</span></font>
<font color="blue"><span style="color:blue">ADD PRIMARY KEY</span></font> (gid);<u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:blue">SELECT</span></font> AddGeometryColumn(<font color="#993366"><span style="color:#993366">'scratch','ab_clsr_land_parcel','geom','3401','MULTIPOLYGON'</span></font>,<font color="#00ccff"><span style="color:#00ccff">2</span></font>);<u></u><u></u></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt">I would have expected the first line to have read <font color="blue"><span style="color:blue">SET</span></font> CLIENT_ENCODING <font color="blue"><span style="color:blue">TO</span></font> LATIN1 instead of <font color="blue"><span style="color:blue">SET</span></font> CLIENT_ENCODING <font color="blue"><span style="color:blue">TO</span></font> UTF8.<u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt">Initially I was attempting to upload a shapefile to a database at work
using this command;<u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt">shp2pgsql.exe -d -s 2956:3401 -I -W "LATIN1"
"C:\0\Canada_Land_Survey_Data\test\Deliverables\CLSR_Land_Parcel.shp"
scratch.ab_clsr_land_parcel | psql.exe -h "localhost" -p
"5432" -U "postgres" -d "major_testing_db"<u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt">Instead of being uploaded, the resulting error occurred:<u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt">ERROR: unterminated quoted string at or near “’”<u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt">LINE 1:
…o”,”remarks”,”pcl_state”,”reg_pin”,geom>
VALUES <’1115077’,’<u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt">
^<u></u><u></u></span></font></p>
<p class="MsoNormal"><u></u><u></u><font face="Times New Roman" size="3"><span style="font-size:12.0pt">Reading</span></font><u></u><u></u>
through the .sql file, I tracked down the problem to be a character not
supported by UTF-8 in the following line (the small arrow highlighted in red);<u></u><u></u></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font color="blue" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:blue">INSERT INTO</span></font> <font color="#993366"><span style="color:#993366">"scratch"."ab_clsr_land_parcel"</span></font>
(<font color="#993366"><span style="color:#993366">"pin","designator","remain_ind","planno","admin_code","pcl_type","lcselectio","remarks","pcl_state","reg_pin",geom)
</span></font><font color="blue"><span style="color:blue">VALUES</span></font> (<font color="#993366"><span style="color:#993366">'1115077','</span></font><font color="#993366"><span style="color:#993366">EJERE K’ELNI KUE INDIAN
RESERVE 196I','No','84988 CLSR AB','09888','Inside Canada Lands',</span></font><font color="blue"><span style="color:blue">NULL,NULL</span></font>,<font color="#993366"><span style="color:#993366">'ACTIVE',</span></font><font color="blue"><span style="color:blue">NULL</span></font><font color="#993366"><span style="color:#993366">,</span></font>ST_Transform('<font color="#993366"><span style="color:#993366">01060000208C0B00…….<u></u><u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt">When I used the shp2pgsql-gui and selected LATIN1 for the character
encoding, the shapefile was uploaded to the database without incident. Any help
and/or explanation would be appreciated. The version of both shp2pgsql and
shp2pgsql-gui that I have used is 2.1.0. Thanks to anyone for their help.<u></u><u></u></span></font></p>
<p class="MsoNormal"><font color="black" face="Palatino Linotype"><span style="font-size:10.0pt;font-family:"Palatino Linotype""><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font color="black" face="Palatino Linotype"><span style="font-size:10.0pt;font-family:"Palatino Linotype""><u></u> <u></u></span></font></p>
<p><strong><b><font color="black" face="Palatino Linotype"><span style="font-size:10.0pt;font-family:"Palatino Linotype"">Michael
Fricker</span></font></b></strong><font color="black" face="Palatino Linotype"><span style="font-size:10.0pt;font-family:"Palatino Linotype""> <br>
GIS Technician<br>
<u></u><u></u>Altus<u></u><u></u> Geomatics<br>
Limited Partnership<br>
<br>
T: 403.234.7599 ext 2395<br>
F: 403.261.4712<br>
<br>
<u></u><u></u>840 7th Avenue SW, Suite 900<u></u><u></u><br>
<u></u><u></u>Calgary<u></u>, <u></u>Alberta<u></u>
<u></u>T2P 3G2<u></u> <u></u>Canada<u></u><u></u> <br>
<a></a><br>
<em><i><font face="Palatino Linotype"><span style="font-family:"Palatino Linotype"">This
message, and the documents attached hereto, are intended only for the addressee
and may contain privileged or confidential information. Any unauthorized
disclosure is strictly prohibited. If you have received this message in error,
please notify us immediately so that we may correct our internal records.
Please then delete the original message. Thank you.</span></font></i></em> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
</div>
</div>
<br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br></blockquote></div><br></div>