OEM to ANSI

How I can convert DOS texts to Windows

Probably first step of DOS to Windows migration is converting DOS texts to Windows.

“Text” may be  .prg,  .txt  or anything else plain text files or tables ( .dbf files ) include Character or MEMO type fields.

This operation will be necessary because foreign ( non English ) characters are different in DOS and Windows.

Fortunately we have Harbour functions to use this purpose: HB_OEMTOANSI() and WIN_OEMTOANSI().

Examples :

Texts files :

cDOS_FName := "MyDOS_xxx.txt"
cWIN_FName := "MyWIN_xxx.txt"
cSourceText := MEMOREAD( cDOS_FName )
cTargetText := HB_OEMTOANSI(   cSourceText  )
MEMOWRIT( cWIN_FName, cTargetText  )

Tables :

REPLACE ALL TEXT_FIELD WITH HB_OEMTOANSI( TEXT_FIELD )

NOTES :

– Don’t worry about file sizes; 64K limit remain in DOS. However you can use line based processing.

– Recommended :

– Use HB_MEMOREAD() and HB_MEMOWRIT() functions instead of  MEMOREAD() and MEMOWRIT().

– Use  WIN_OEMTOANSI( )  instead of  HB_OEMTOANSI()

– Inverse functions are WIN_ANSITOOEM( )  and  HB_ANSITOOEM( )

Advertisements

4 responses to “OEM to ANSI

  1. Pingback: Migration DOS to Windows | Viva Clipper !

  2. Pingback: HMG Samples | Viva Clipper !

  3. Pingback: How I can print | Viva Clipper !

  4. Pingback: How I Can Do … | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s