EasyGIS.NET icon indicating copy to clipboard operation
EasyGIS.NET copied to clipboard

Converting strings in DBF File from Codepage Central Europe Windows - 1250 to UTF8

Open dusko23 opened this issue 2 years ago • 4 comments

Hi, One of the functions I am implementing is a tool to convert DBF Files from one Codepage to a different one. Typically UTF-8. Here is an example of one capital letter image Codepage Central Europe Windows - 1250

Converting it to bytes gives the following result one byte value of 200

Converting 200 to UTF-8 gives the following result two bytes 196 140

This is correct according to Wikipedia image

The following conversion was used image inputE is Central Europ Windows - 1250 outputE is UTF-8

The final string to be written by DbfWriter Class is image two bytes 196 140

However, when I read DBF File and the letter Č is expected I got 3 Bytes containing values: 239 191 189

It appears that DdfWriter Class Writes 3 bytes instead of two. DbfWriter writes bytes to a file at the end. Just not sure why it writes 3 bytes instead of 2. I also understand that DbfWrier is looking at the string and probably not knowing what is Code Page the string belongs to. Could anybody tell me what am I missing here?

dusko23 avatar Oct 06 '22 12:10 dusko23