1

I am having a *.dbf-file.

When I load it into QGIS (delimited text-file) I am having trouble getting all the characters right.

Either I load it in encoding=windows-1252 - then the headers will be shown correctly, but the features wont or I load it in utf-8 and then the features will be shown correctly, but the headers wont.

I am talking about "æøå" -characters.

  • How does the table look in LibreOffice? I guess it is easier to change the headers there. – AndreJ Jul 16 '16 at 5:37
  • I guess you haven't experienced it? It has to be automated. So making things manually is just a method of "proof of concept". But there might be a binary or something in Libreoffice that could do the work of converting. Otherwise I will have to look into reg_exp-methods of replace(char). Did you do such thing? – MichaelR Jul 16 '16 at 11:04
  • I do such things manually. Anyway, changing the headers will be easier than going through all records. You could do that even inside QGIS with a python script. But don't ask me for code... – AndreJ Jul 16 '16 at 14:35
1

Can a table (.dbf) be encoded in two different systems?

Yes. it is possible however it is not recommended.

DBF File Specification

As the specification shows, dbf file (dBase 3 - 5) have three parts: 1. Header 2. Field Headers Part 3. Records (Data). All programmer who write software must use Two-Bytes Fixed-Length encoding like windows 1256 when writing the the field names in field headers and when write text data in the record part. That's important because dbf file is a binary file and length of each part should be pre calculated and stored in the header part.

What just happened?

Imagine a software like ArcMap use two different encoding when writing the dbf file to the hard. Then this kind of problem will arise when using different software to read that dbf file. However using UTF8 provide us with the benefit of creating dbf file with smaller size when working with English characters but

  1. It makes some other characters from other languages consume more space! So data lost may occur in some cases and
  2. Problems arise when using other softwares and trying to read these dbf files.

I personally see this problem months ago and use two different encoding in my library to read dbf files (one for header and the other for records)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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