I have to set the character encoding for all layers from system to UTF-8.
Is there a way to change this in all loaded layers at once?
I'm using QGIS 2.8.1 on Windows 7.
encodingpyqgis
I have to set the character encoding for all layers from system to UTF-8.
Is there a way to change this in all loaded layers at once?
I'm using QGIS 2.8.1 on Windows 7.
Best Answer
You can use the following which should set the encoding of your loaded layers to UTF-8:
Syntax for PyQGIS 2:
Syntax for PyQGIS 3:
Remember to save your project file (.qgs) afterwards.
Edit:
As suggested by @meles, you can input the above code into the Python Console (Plugins > Python Console; Extensions > Python Console; Ctrl + Alt + P).
Hope this helps!