c# – How to specify the encoding in a request to dbf?


There is a dbf file created by Visual Fox Pro. I can't change it, I can only read it. I read

 conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\\;Extended Properties=dBASE IV;User ID=;Password=;";
                    OleDbCommand comm = conn.CreateCommand();
                    comm.CommandText = @"SELECT NOMER, FEMGN, FEOBS, DATA, TIME FROM ANALIZ";
                    column = dt.Columns[0];
                    row = dt.Rows[0];
                    result = row[column].ToString();
                    dataGridView1.DataSource = dt

But in the file encoding dos. Must be converted to utf -8. I'm trying that – it doesn't work

 var fromEncodind = Encoding.GetEncoding(866);//из какой кодировки
                var bytes = fromEncodind.GetBytes(o);
                var toEncoding = Encoding.UTF8;//в какую кодировку
              string  ans = toEncoding.GetString(bytes);

Probably from basis already I receive a clumsy line. Tell me how to specify the encoding in the request to dbf


DBF tables with 866 encoding are loaded normally if loaded via OLE DB Provider for Visual FoxPro 9.0

private void LoadTable(string path, DataGridView dataGrid)
            var connectionString = "Provider=VFPOLEDB.1;Data Source=" + path + ";Collating Sequence=MACHINE";
            var con = new OleDbConnection(connectionString);
            var adapter = new OleDbDataAdapter("SELECT * FROM " + Path.GetFileNameWithoutExtension(path), con);
            var dataSet = new DataSet();
            dataGrid.DataSource = dataSet.Tables[0];                
        catch (Exception err)
            MessageBox.Show(err.Message + " " + path, "Ошибка открытия DBF таблицы", MessageBoxButtons.OK, MessageBoxIcon.Error);                
Scroll to Top