I have text with French accent in a DXF I import in QGIS3.16. The DXF is encoded in UTF-8 but as a result, the features attributes have encoding problems. The é
charcacter are written é
.
Here's a portion of the code used:
# -*- coding: utf-8 -*-
layer = QgsVectorLayer(dxf_path + "|layername=entities|geometrytype=Point", "dxf_linestring", "ogr")
layer.setProviderEncoding(u'UTF-8')
QgsProject.instance().addMapLayer(layer)
When I convert the DXF from UTF-8 to ANSI in Notepad++, the problem is solved but I would prefer to convert in the script rather than converting the whole file.