[GIS] Stop automatic ANSI_1252 to UTF-8 encoding when adding a DXF layer

dxfencodingqgis

I have a DXF file encoded in ANSI_1252, with object attributes containing umlauts. When I open it in QGIS, the umlauts don't display properly. This apparently happens because QGIS automatically sets the character encoding to UTF-8. In Layer Properties / General the Data source encoding is set to UTF-8 and greyed out, so I can't change it there either. How can I keep the ANSI_1252 encoding?

Best Answer

One possible solution to the problem: Open the DXF file in a texteditor and save the file with the encoding that is used by QGIS. In my case I had a DXF file exported from AutoCAD with encoding UTF-8, with Swedish text. I found out that by trial and error that saving the DXF-file with ANSI encoding the text was displayed correctly in QGIS.

I used notepad++ to open the DXF-file and converted the encoding to ANSI and saved the file and then opened the file again in QGIS.