Alophind
Alophind

Reputation: 862

C# - Trying to read hebrew from DBF file and keep getting gibberish (code and file inside)

I want to read the data from this dbf file :

http://77.235.53.170/test.rar

The last column name is in hebrew , I'm using this code:

OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\;Extended Properties=dBASE IV;Locale Identifier=1033");
            try
            {
                con.Open();
                OleDbDataAdapter da = new OleDbDataAdapter("select * from test.dbf", con); 
                DataSet ds = new DataSet();
                da.Fill(ds);
                con.Close();
                int i = ds.Tables[0].Rows.Count;
                return true;
            }
            catch (Exception e)
            {
                var error = e.ToString();
                // check error details 
                return false;
            }

and the column names keep coming as gibberish. I've also tried "Local Identifier=1255" and it didn't work.

This is what I get in c# enter image description here

This is how it should look like enter image description here

Using .Net 4 windows 7.

Help will be appreciated.

Upvotes: 0

Views: 577

Answers (1)

user2263986
user2263986

Reputation: 90

  1. Convert the .dbf to .csv. Ignore the gibberish.
  2. Open the .csv with Internet Explorer (File > Open > Browse, Files of type = all)
  3. In View > Encoding find a codepage that properly shows your text, keep trying until one works, such as 4 Hebrew.
  4. When found, select everything you can see
  5. Copy and Paste to MS Word or notepad
  6. Save as a new .csv file
  7. Export it

Upvotes: 1

Related Questions