Converting from the DOS OEM to Windows ANSI character sets

  • Thread starter Casteele/ShadowLord
  • Start date
C

Casteele/ShadowLord

Hi,

I'm creating a database which has a VBA module to read a number of records
in from a old DOS based file (which uses the old DOS OEM characterset), and
fill an Access 2000 table with the data. However, Windows (and Access 2000)
use the ANSI character set. The StrConv function only seems to convert from
ANSI <-> Unicode, and a few other specialized charsets (Far East). But they
do not appear to handle OEM at all.

How can I convert (using only Access 2000/VBA; I cannot rely on 3-rd party
or external utilities) this data from DOS OEM to ANSI? (So far, the only
thing I can come up with is to create a table that has the OEM char in one
column, and the ANSI char in the other, then write code which loops through
the text replacing one with the other.. But I'm hoping for a better solution!)

Thanks,
C.
 
G

GeoffG

I flagged your post two days ago to see if anyone with expertise in this
area would answer. If you still need comments, I have a few - and an
interest in how you actually solve the problem.

Is your DOS OEM something like Compaq DOS Version 3.31 or DR DOS? Do you
know which character numbers represent which characters?

It's odd that the OEM didn't use ASCII, Extended ASCII, ANSI, Code Page 437
(aka MSDOS Latin US), or some other code page. There's also DBCS and
Unicode.

Visual Basic always uses Unicode, whichever version of Windows it's running
on (i.e. whichever character set is native to your version of Windows).

I'm not sure there's a better solution than something like the one you
suggest. I'd be inclined to use VBA to read the text file into a character
array, loop through the array making character substitutions where
necessary, writing back to a text file, and using the normal import wizard.

Are you happy that the text files are good (i.e. not corrupted)? Does each
character number stored in the text file reliably represent a given
character?

Regards
Geoff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top