0

There is a service that exports layer objects to the MapInfo .tab format. This service uses the Gdal 3.3 library version. The service is deployed on a Linux server. There is a problem with exporting objects that have Cyrillic characters in their attribute names. No matter how I specify or explicitly translate the fields to UTF-8 before adding them to the layer, there is still no result. How do I specify an explicit UTF-8 encoding for the fields of my files so that this encoding is necessarily applied?

Fragment of service:

using (var myDriver = Ogr.GetDriverByName("MapInfo File"))
using (var myDataSource = myDriver.CreateDataSource("my_file.tab", new string[] { "ENCODING=UTF-8" }))
using (var myLayer = myDataSource.CreateLayer("LAYER_NAME", src, wkbGeometryType.wkbUnknown,
           new string[] { "ENCODING=UTF-8" }))
{
    foreach (var attr in attributes)
    {
        var featureDefinition = new FieldDefn(attr.Key, attributeType);
        myLayer.CreateField(featureDefinition, 0);
    }

    var layerDefinition = myLayer.GetLayerDefn();
    foreach (var layerObject in objects)
    {
        var feature = new Feature(layerDefinition);
        feature.SetGeometry(layerObject.Geometry);
        foreach (var (key, value) in layerObject.Attributes)
        {
            feature.SetField(key, value);
        }

        myLayer.CreateFeature(feature);
    }
}

But in QGIS with UTF-8 I have this result

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.