qgis/Quantum-GIS — pull request #492 by borysiasty (2013-03-31 14:25:33+00:00)
Title: Fix shapefile encoding in QgsVectorFileWriter

Another small (but important) step in solving the well known encoding problem. It enables QGIS to produce not corrupted shapefiles without passing any specific oprions, even if ignoreShapeEncoding is not enabled.

If the format is Shapefile, QgsVectorFileWriter:
1) always sets the ENCODING layer creation option to the destination encoding
2) if ignoreShapeEncoding==true, sets SHAPE_ENCODING to "" and leaves the fileEncoding as is (the destination encoding )
3) if ignoreShapeEncoding==false, sets SHAPE_ENCODING to the destination encoding and fileEncoding to UTF-8 (the layer internal encoding, what is required to properly save a shapefile)

The long-term solution will be to replace the global ignoreShapeEncoding variable with layer-specific one, because in fact it only takes a result during creation underlaying GDAL object, thus you can have two layers in different states at the same time. It would also allow to enable/disable the layer encoding selector in layer properities depending on it's real usability.