<div dir="ltr"><div><div><div>Hi,<br><br></div>I am sorry about the noise. The only thing I was correct in the first post was that I was confuse. My problem was not related to encodings, but to the field types width and precision limitation that are different in MapInfo software and FME and QGIS. That was what made MapInfo crashing.<br>
<br></div>Thank you Even for your reply anyway that confirms the encoding process is correct.<br><br><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 30, 2014 at 9:31 AM, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@mines-paris.org" target="_blank">even.rouault@mines-paris.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Le mardi 29 avril 2014 21:32:11, Max Demars a écrit :<br>
<div class="">> Hi,<br>
><br>
> I am a bit confused right now about a possible difference in encoding<br>
> attribute value that I have noticed between those two drivers (MapInfo File<br>
> vs ESRI Shapefile).<br>
><br>
> I have a script that allow user to export some features from database to<br>
> shapefile or MapInfo TAB format. However, in MapInfo TAB the attributes are<br>
> not encoded correctly in utf-8, contrary than shapefiles.<br>
><br>
> The same data and the same code is used, and I am starting to think that<br>
> the difference is coming from inside the OGR drivers.<br>
><br>
> OGRFeature.SetField("FiedlName", value.encode('utf-8')) #value is unicode<br>
><br>
> Anybody have information about this issue? I dont really know where to<br>
> look.<br>
<br>
</div>Works for me :<br>
<br>
$ cat foo.csv<br>
id,text,WKT<br>
1,éven,"POINT(0 0)"<br>
<br>
$ file foo.csv<br>
foo.csv: UTF-8 Unicode text<br>
<br>
$ ogr2ogr -f "mapinfo file" foo.tab foo.csv<br>
<br>
$ ogrinfo foo.tab -al<br>
Had to open data source read-only.<br>
INFO: Open of `foo.tab'<br>
using driver `MapInfo File' successful.<br>
<br>
Layer name: foo<br>
Geometry: Point<br>
Feature Count: 1<br>
Extent: (0.000000, 0.000000) - (0.000000, 0.000000)<br>
Layer SRS WKT:<br>
LOCAL_CS["Nonearth",<br>
UNIT["Meter",1.0]]<br>
id: String (254.0)<br>
text: String (254.0)<br>
WKT: String (254.0)<br>
OGRFeature(foo):1<br>
id (String) = 1<br>
text (String) = éven<br>
WKT (String) = POINT(0 0)<br>
Style = SYMBOL(a:0,c:#000000,s:12pt,id:"mapinfo-sym-35,ogr-sym-10")<br>
POINT (0 0)<br>
<br>
<br>
><br>
> -Max Demars<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Geospatial professional services<br>
<a href="http://even.rouault.free.fr/services.html" target="_blank">http://even.rouault.free.fr/services.html</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><div><div><div>Stack Overflow: <a href="http://stackoverflow.com/users/1914034/burton449" target="_blank">http://stackoverflow.com/users/1914034/burton449</a><br>
</div></div>GIS Overflow: <a href="http://gis.stackexchange.com/users/14426/burton449" target="_blank">http://gis.stackexchange.com/users/14426/burton449</a><br></div>LastFm: <a href="http://www.lastfm.fr/user/burton449" target="_blank">http://www.lastfm.fr/user/burton449</a><br>
</div>
</div>