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.

I have to work with the Shapefiles, and all is fine except data in *.dbf

When I have first deserialized file, I have thought, that I'm doing smth wrong, but when any soft like (QGIS, SAGA, ESRI shapefiles reader, GRASS GIS are reading in the same result, I have thought that source file was in the incorrect format from the beggining).

Any soft shows the next encoding from *.dbf data:

http://s15.postimg.org/lji3hjywr/image.png

Then, I've read about dBase, which is used in Shapefiles and the default encoding (LATIN1), but the docs are very confusing, because somewhere I've read about LATIN1, but at other website there is info, that for Russian maps the default encoding is: OEM866.

I've tried to reencode, but again no success.

I've downloaded the shapefiles from different sources (from bbbike and other web repositories of maps), but the same result from different resources.

My aim is, to work normally with the Moscow, Russia map, which is available here: http://download.bbbike.org/osm/bbbike/Moscow/

share|improve this question
    
Please specify which part of your example you are concerned about. It is not clear from the image you linked to, what the problem is, though I could make a guess. It looks like the entries in the Name attribute are different than the OSM_ID, or the TYPE attributes. The fact that those two are correct though, makes me wonder if something else is going on. If encoding is wrong somehow, it seems it would affect all attributes, not just one. Please be more specific about your problem, and what you hope to achieve. –  Get Spatial Sep 30 '13 at 15:52
    
@GetSpatial I'm specific as much as I could be. The problem is that a column Name does have a problem with encoding. I guess, that other data in other columns don't have such a problem, becase an English text is translated pretty fine in many encodings, and the original problem is with the encoding which includes native langauge for own culture (russian, turkish etc) and english culture together. –  user22170 Oct 1 '13 at 7:32

2 Answers 2

up vote 2 down vote accepted

The problem was because, originally data in *.dbf file for Russian langauge exactly are often saved in OEM-866 encoding format.

QGIS seems to be are marking convertions to the Unicode.

For e.g. if you want to get the normal text (in UTF-8 for e.g.) from *.dbf you can do the next (sorry, that I'm provding only C# code, but I think in other programming languages operations are similar):

static string Convert866ToUTF8(string value)
{
    var resultValue = Encoding.UTF8.GetString(Encoding.GetEncoding(866).GetBytes(value));
    return resultValue;
}

It has hepled me in developing some cleint application with C# langauge.

share|improve this answer

Currently, you can use any encoding in Shapefiles and the most common is Unicode. (and OpenStreeMap data use Unicode)

I have no problem to open the Moscow shapefiles in QGIS and the Cyrillic characters appears:

enter image description here

If you look at the properties of the layer, you can see that the encoding is 'UTF-8' (Unicode)

enter image description here

-> you know the encoding of your shapefile and you can change the encoding if you want.

share|improve this answer
    
trully I've tried to open in QGIS the shapefile from different encodings, I've tried to import from: LATIN1, OEM866, win1251, utf-8, Unicode and tried to save in utf-8 as in output. But always the encoding was bad. Did you download a shapefile from the website I've added in the question? Or you've downlaoded from other website. –  user22170 Oct 1 '13 at 7:19
    
I download the shapefile from your webside and I don't choose the encoding -> automatic for me –  gene Oct 1 '13 at 15:03
    
I did the same and no issues at all. I can open it up in QGIS as gene mentioned :) –  Farhat Abbas Oct 2 '13 at 6:10
    
@FarhatAbbas it would be a pleasure for me if it was also as the same as at yours... You've looked the screenshot in the question body and I've said, that I tried to open in various editors and QGIS isn't ax exception, but encdoing is bad only for me... I don't understand, what's wrong? :( –  user22170 Oct 2 '13 at 6:26
    
@gene I see... But I think you see too, that I'm not lying about my work with *.shp... I even can't normally open it in QGIS, why? I don't understand... :( –  user22170 Oct 2 '13 at 6:28

Your Answer

 
discard

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