<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div><span>Lars,</span></div><div><br><span></span></div><div><span>When you try to load some data to a PostgreSQL server, you can specify the encoding to use.</span></div><div><span><br></span></div><div><span>This can be done with </span><span><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">client_encoding</span>. For example, if you want to populate a table with some CSV file contents, you have <br></span></div><div><span>to do the following:<br></span></div><div><br><span></span></div><div style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span>SET client_encoding = 'LATIN1';</span></div><div><span><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">COPY my_table FROM '/usr/file.csv' WITH CSV</span><br></span></div><div><span><br></span></div><div><span>Now, when
 you use <span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">shp2pgsql</span> you can't set the client encoding, but you can set the default <span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">client_encoding</span> of your <br></span></div><div><span>database </span><span>and every data transfer between some client and your database will be encoded properly:</span></div><div><br><span></span></div><div style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span></span><span>ALTER DATABASE my_database SET client_encoding = 'LATIN1'<br></span></div><div><br><span></span></div><div><span>Hope this helps</span></div><div><br><span></span></div><div><span>Cheers from Guadalajara, México<br> </span></div><div><font class="yui_3_2_0_5_131230857527252" style="font-weight: bold; color: rgb(0, 96, 191); font-family: verdana,helvetica,sans-serif;" size="2"><br></font></div><div><font
 style="font-weight:bold;color:rgb(0, 96, 191);font-family:verdana, helvetica, sans-serif;" size="2">IC Carlos Ruiz</font><br><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><font face="Arial" size="2"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> Lars Lingner &lt;gislars+list@googlemail.com&gt;<br><b><span style="font-weight: bold;">To:</span></b> "'mapserver-users@lists.osgeo.org'" &lt;mapserver-users@lists.osgeo.org&gt;<br><b><span style="font-weight: bold;">Sent:</span></b> Tuesday, August 2, 2011 2:45 PM<br><b><span style="font-weight: bold;">Subject:</span></b> [mapserver-users] how does mapserver determine shapefile encoding?<br></font><br>Hello,<br><br>I have a shapefile from which I don't really know the encoding. It might<br>be latin1 or ISO-8559-5. The good thing is, when MapServer is accessing<br>the
 shapefile, the labels are shown correct.<br>QGis is also displaying everything fine.<br><br>But when I try to convert with shp2pgsql or ogr I get only garbage back.<br>I tried different source encodings. Since I need the data to be in the<br>database I'm now trying to find out where the problem is.<br><br>I tried converting the data on different systems (Ubuntu, RedHat), with<br>postgis/shp2pgsql from repository as well as self compiled. Same<br>results. Also iconv and recode wasn't a help.<br><br>As I said QGis is displaying everything fine it fails in converting the<br>shapefile too. Opening the dbf in LibreOffice doesn't helped either.<br><br>Finally my (odd) questions are: Why does MapServer do everything right?<br>How is the encoding determined? Can I see somewhere which encoding is<br>used by MapServer?<br><br>Thanks in advance for any pointers.<br><br><br>Lars<br>_______________________________________________<br>mapserver-users mailing
 list<br><a ymailto="mailto:mapserver-users@lists.osgeo.org" href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br><br><br></div></div></div></body></html>