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")

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.

  • What about changing encoding in layer properties on the source tab? – Zoltan Dec 27 '20 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.