[fdo-users] FDO OGR 4.1 still has problems with Latin1/ISO-8859-1 when using MapInfo TAB
Hans Milling
hm at geograf.dk
Fri Oct 7 05:14:37 PDT 2016
Hi Jackie
I am not familiar with Vanilla (Google search did not reveal anything),
however I tried a simple console application and using the 4.0 binaries.
A name with a danish/latin letter like:
Næsborg
turns out as:
N波org
OSGeo.FDO.IConnectionManager mConnMgr =
OSGeo.FDO.ClientServices.FeatureAccessManager.GetConnectionManager();
IConnection mProvConn = mConnMgr.CreateConnection("OSGeo.OGR.4.0");
IConnectionInfo connInfo = mProvConn.ConnectionInfo;
IConnectionPropertyDictionary connPropDict =
connInfo.ConnectionProperties;
connPropDict.SetProperty("DataSource", @"C:\test\names.tab");
connPropDict.SetProperty("ReadOnly", "TRUE");
mProvConn.Open();
IDescribeSchema schemaCmd =
mProvConn.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_DescribeSchema)
as IDescribeSchema;
FeatureSchemaCollection schemaCol = schemaCmd.Execute();
ISelect selCmd =
(ISelect)mProvConn.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_Select);
selCmd.SetFeatureClassName("names");
IReader myReader = selCmd.Execute();
while (myReader.ReadNext())
{
string name = myReader.GetString("name");
Console.WriteLine(name);
}
If I try to convert the name from UTF8 to bytes and back to a string:
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(name);
string newname =
System.Text.Encoding.GetEncoding("ISO-8859-1").GetString(bytes);
I get this output:
Næ³¢org
Seems like the data is corrupted somehow.
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/FDO-OGR-4-1-still-has-problems-with-Latin1-ISO-8859-1-when-using-MapInfo-TAB-tp5289710p5289782.html
Sent from the FDO Users mailing list archive at Nabble.com.
More information about the fdo-users
mailing list