Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is there a way to encode shapefiles from LATIN1 to UTF-8?

share|improve this question

3 Answers 3

up vote 11 down vote accepted

You can do this with QGIS. First load your shapefiles then save as and coding select dropdown menu utf-8 and then save your file.

share|improve this answer
    
Thank you, this is the best option. –  againstflow Oct 19 '11 at 13:13
6  
Word of caution: for this solution to work qgis must be started in a LATIN1/ISO-8859-1 environment when you open the input shapefile or it won't read it correctly. If you are working in an UTF8 enviroment the conversion might fail silently, corrupting the data, depending on the data in the shapefile. BTW, most OSes now default to UTF8. –  unicoletti Oct 19 '11 at 15:48
    
Note that in some situations it may not work, I had this kind of issues: (osgeo-org.1560.n6.nabble.com/UTF-8-no-more-td4647456.html) –  JaakL Jul 16 '12 at 5:48

Assuming that you are on Linux and have access to a recent version of GDAL you can try the following (from this post) :

 export SHAPE_ENCODING="ISO-8859-1"
 ogr2ogr output.shp input -lco ENCODING=UTF-8

Note: LATIN1 should work too instead of ISO-8859-1.

In Windows, do NOT set the SHAPE_ENCODING, ogr2ogr does not recognize ISO-8859-1, nor LATIN1.

share|improve this answer
    
Just to clarify, “recent” here seems to mean 1.9.x. I tried this with 1.8.1 and it did not work, tried again with 1.9.1 and it did. –  Michal Migurski May 26 '12 at 4:59
    
Didn't work for me on Windows. –  Pavel Radzivilovsky Nov 21 '12 at 21:16
    
Got it to work in Windows, have updated the answer. –  flup Feb 10 '13 at 23:29
    
Do you know if I can look-up the list of valid values for SHAPE_ENCODING somewhere? –  JJD Feb 28 at 13:30
1  
@JJD They are the same used by iconv: gnu.org/software/libiconv –  unicoletti Mar 2 at 15:46

If my understanding of Shapefiles is correct, the part that is encoding-sensitive is the attribute database contained in the DBF file.

Here is an answer that helped me solve this issue using LibreOffice Calc/Base:

http://gis.stackexchange.com/a/3663/17998

It has the additional benefit that you can open the DBF file using a distinct character set and thus find out what the current encoding actually is.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.