Link to home
Start Free TrialLog in
Avatar of danifer
danifer

asked on

Encoding problems with C# .NET OLEDB connection to a Paradox database

Swedish characters åäö are replaced with Õõ÷ and so on after retrieving
data from the OleDbDataAdapter.

This is my connection string

string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + sPath + ";Extended Properties=Paradox 5.x;";


And this is my query code

             OleDbDataAdapter oleAdapter = new OleDbDataAdapter(sQuery, oleConection);
                                                               
                DataSet dsRetrievedData = new DataSet();
                oleAdapter.Fill(dsRetrievedData);
               
                this.dataGridView1.DataSource = dsRetrievedData;
                this.dataGridView1.DataMember = dsRetrievedData.Tables[0].TableName;

I have generally just looped thru the dataset and
wrote data to files and/or showed them as message.
I have also tried fill it to a datagridview but characters are always
wrong....

help me pleease...
Avatar of danifer
danifer

ASKER

I have also tried using ODBC in .NET but with the same results.
Avatar of Pavel Celba
My answer probably does not help but it just could mean the Paradox database has no Code page or its Code page is not compatible with .NET environment. Do you know what Code page is used in Paradox db?

Some ideas for BDE are mentioned here: http://www.tek-tips.com/viewthread.cfm?qid=811791&page=31 but it probably does not help.
Also the following link does not help most probably: http://www.thedbcommunity.com/index.php?option=com_content&task=view&id=234&Itemid=44

You could also try to download newer Microsoft ACE.OLEDB.12 driver: http://www.microsoft.com/downloads/details.aspx?FamilyID=7554F536-8C28-4598-9B72-EF94E038C891&displaylang=en (I am pesimistic again...)

Another possibility is to write your own converter and use it in .NET or export Paradox data into different format (e.g. DBF) and use this format.
Avatar of danifer

ASKER

Thanks for your answers.

Not 100% sure of the codepage but I have tried viewing it with all sorts of possible codepages without any luck.

First links Ive already looked at since I've been goggling this for 2 weeks now.

It seems like it´s an issue between the communication between the driver/oledb and the paradox.
Since I've tried converting the arriving data from all types of encoding types to utf8 and what not,
without success. Seems like .NET converts the data before my code but not doing a good job at it  and resulting in "corrupt" data.

I haven't looked on that new driver. Does it really apply to paradox databases?

At this moment I have did the worst hack; replacing the wrong characters to their counterparts...but this isn't a solution for characters has become characters that are encoded correctly..so this is really not an option.... =)
The new driver supports Paradox but the level of implementation is probably same as in the old one. Microsoft released even one more driver for Office 2010 but it is still in beta.

Are you able do retrieve character codes from Paradox database and compare them to .NET ones? It could just be wrong font used but if the .NET characters are stored in Unicode strings then the problematic part is most probably the driver. Also what is your local settings in Windows?
Avatar of danifer

ASKER

According to Paradox Viewer (http://www.shareup.com/Paradox_viewer-download-22359.html) these tables are encoded in ANSI (windows codepage).

I have tried converted these as ANSI to UTF8 so that that doesn't help.

The only worrying thing is that this tool is reporting that the table version is 7.0
while I use 5.x in the connectionstring. I have not seen a connectionstring that
works with 7 though.

I only need read-access so it wouldn´t be a problem to use some driver that only supports this.

With local settings you mean?
I use english Win7 with swedish locale settings.
ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of danifer

ASKER

I'm gonna try the DataDirect drivers and then see how expensive they are :)
Avatar of danifer

ASKER

DataDirect drivers returns text in correct encoding :] Happy days. Lets hope they aren´t too expensive. Thanks.
Hmm, they do not seem cheap... 5 users pack of something for $600.