I tried to change the only the shapefile datasource encoding through properties and also How to encode shapefiles from LATIN1 to UTF-8? but it doesn't change it.
Without saving the QGIS project can't I directly change the shapefile datasource encoding?
I also tried this code, it shows change encoding but as I open the shapefile again it show the same old system encoding:
for layer in QgsMapLayerRegistry.instance().mapLayers().values():
layer.setProviderEncoding(u'UTF-8')
layer.dataProvider().setEncoding(u'UTF-8')
print layer.name(), layer.dataProvider().encoding()
(I am not saving QGIS project, just accessing and saving shapefile directly. When I save the project and do this task then it work correctly)
No comments:
Post a Comment