Reading text files via ADO in VB6 - How to handle UTF files

I am using ADO to open text files as a recordset in VB6, but the files are not opening correctly - they won't read the column headers.  I believe the problem is the encoding/code page of the text file.  The files are supplied by a vendor so I can't control the encoding, but some are UTF-8, and I'm sure others will vary.  

Once I convert them to ANSI my code works correctly.  Two questions - what code page does ADO expect, and can I open the file specifying the codepage?  I'm using the following to open the file:
ImportConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                       "Data Source=" & ImportDirectoryName & ";" & _
                       "Extended Properties=""text;HDR=YES;FMT=Delimited"""

Second, I found code that tells me what encoding the file uses, but I am having trouble finding code that will convert the file.  If I need to use ANSI, can someone tell me an efficient way in VB6 to convert the file so I can import it properly?
 
FNDAdminAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
According to this example I found on the web you don't seem to have the Extended Properties and the rest after that 'punctuated' correctly.


connCSV.Open "Provider=Microsoft.Jet" _
        & ".OLEDB.4.0;Data Source=" & App.Path _
        & ";Extended Properties='text;HDR=Yes;" _
        & "FMT=Delimited'"
0
FNDAdminAuthor Commented:
The file seems to read in ok as long as it is ansi, so I'm guessing the punctuation just isn't looking correct on the post.  The problem, from what I can tell, seems to be related to the code page on the file, though I will look at the punctuation more closely.  Thank you.
0
GrahamSkanRetiredCommented:
The usual problem is that semi-colons and commas are special characters that are treated differently between regions.

UTF-8 is designed to be as compatible as possible with ASCII, so that could be a misdiagnosis of your difficulty.

Could you post a bit of the file (including the header), please?
0
FNDAdminAuthor Commented:
It appears the problem was indeed the format.  Once I used some really slow code to convert the text file to ANSI everything worked fine.  I was unable to find efficient code to convert the file, but what I did find works.  Thanks for you help.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FNDAdminAuthor Commented:
Thanks for all your help, but the problem was with the format itself.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.