Sunday 24 March 2019

shapefile - encoding problem with QGIS 1.8 and CSV import


I have following problem with QGIS 1.8. Lisboa (standalone installer, Win 7 Pro 64bit) - I import CSV - text in CP1250 separated with ";" and using "," as decimal separator.


I correctly set the separated text importer, get correct point layer which has all text entries displayed correctly. I save this as shapefile, set the CP1250 encoding but when I load this layer in QGIS (choose CP1250 again during SHP loading) but get point layer with damaged text entries.


I use this tool for a long time and did not have such problems. Did you have encounter such problems?


thanks



Answer




Qgis 1.8.0 has a bug in correct encoding of shapefiles. Until this is solved, you can try this workaround in Windows:


Browse to C:\Programs\Quantum GIS Lisboa\bin on Windows XP or C:\Programs (x86)\Quantum GIS Lisboa\bin on Windows 7. Look for qgis.bat and open it with a suitable editor (I have installed notepad++ for such things). After line 1, insert:


SET SHAPE_ENCODING=UTF-8

This will ensure that all entries are encoded correctly. Of course, you have to save the shapefile in UTF-8 to make encoding properly.


Or, save as spatialite database. There are no known encoding issues with that.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...