2

I have an old DOS program (EarlyBird - EB.EXE) that has worked fine for many years on my WIN XP Pro system. The program is started by a shortcut to the .exe (a *.pif file I believe) and is executed by NTVDM and appears to use AUTOEXEC.NT and CONFIG.NT.

Since I have moved from the US to the UK I have recently changed the regional option to UK from US. Now the 'DOS' window will not display the "box drawing" characters correctly.

If I start a CMD prompt and type chcp it displays the Code Page as 850 which seems to be OK although it used to be 437. However, the Early Bird DOS program has a DOS shell exit and if I use that and type CHCP I get the answer 1252.

I have, with the help provided here by @Doktoro Reichard, carried out various experiments including setting the code page in the registry, starting a .bat file with a force via chcp to various code pages, none of these seemed to work.

Finally I reverted the locale back to US and the box drawing characters are now working fine. Strangely enough, a DOS exit from the EB program STILL shows the cp as 1252 whereas a CMD prompt shows 437. This is confusing.

However, I really want the Windows locale to be UK (for a variety of reasons such as date formats, 24-hour clock etc) but I still need my old DOS program to work correctly.

Is there a way to set the locale to UK and still get the correct drawing charaters under NTVDM via the *.pif shortcut?

Thanks

David

David
  • 21
  • 2

1 Answers1

2

You have unintentionally answered your question:

... but I have recently changed the regional option to UK from US.

That's why the command prompt isn't displaying the correct characters. According to the documentation about chcp:

CHCP.com

Change the active console Code Page. The default code page is determined by the Windows Locale.

Syntax:

CHCP code_page

     code_page  - A code page number (e.g. 437)

By changing from the US to the UK Code Page, you have also changed the way the characters look. If you look at the following pictures, you can then see why the box characters aren't being rendered: because they aren't there:

Luckily though, the solution is simple: run chcp 850(which, although it isn't the original US version, it is mostly compatible with Code Page 437) or chcp 437 at the start of the current command prompt.

Code Page 437 (IBM-ASCII)

Code Page 437 (IBM-ASCII)

.

Code Page 1252 (Western Europe)

Code Page 1252 (Western Europe)

Doktoro Reichard
  • 5,390
  • 5
  • 35
  • 42
  • Thanks, If only it were that simple - any CMD prompt started now shows Code Page to be 850. HOWEVER as I said above an exit to the DOS shell shows page to be 1252. I think you are telling me to edit the *.pif file to include a CHCP command to force it to 850 BUT why is it using 1252 - that's not set in the locale which is correctly set to UK – David Jun 15 '14 at 10:13
  • I apologize if I was unclear. The simplest way to "fix" this is, as I stated, to run `chcp` before any command. If you're running your program directly, then making a `.bat` with `chcp` and then your program will work. The reason why it is using CP 1252 is, as I stated, you set up the locale as UK, which uses the 1252 CP. If you want to keep the locale and have any codepage you want, though, it seems someone else answered this [here](http://superuser.com/q/387569/228536) – Doktoro Reichard Jun 15 '14 at 14:25
  • Thanks again - I may be missing something but I need a tad more help. If I use the Command Prompt under Windows I get the DOS window and typing chcp in that window results in 850 which is what I want. However the *.pif creation (shortcut to the .exe) uses AUTOEXEC.NT and CONFIG.NT and that results in the Code Page being set to 1252. I tried the edit to the registry and added the AUTORUN = chcp 850 but that has had no effect. Other than creating new .bat file instead of the *.pif is there any other way of forcing the 850 code page? – David Jun 15 '14 at 14:39
  • Hi again, I tried creating the .bat file which contains two lines: chcp 850 and eb.exe. The result is the screen is still not showing the box drawing characters but the DOS shell exit now show cp to be 850. This was working even after I changed the locale, is there any other windows parameter I can alter to achieve the right effect? – David Jun 15 '14 at 14:50
  • Change it to CP 437 and it should work. Most likely that program is using characters such as these (╡ ╢) that aren't mapped in the 850 (which is the Western Latin script and has characters such as Á Â mapped instead). Also, the CP 437 IS the US page and as such should work as well. – Doktoro Reichard Jun 15 '14 at 17:24
  • I tried that - still didn't work even though the exit to DOS shows cp IS 437. There is a mystery here, something is throwing this off – David Jun 16 '14 at 10:20
  • Do you need the UK locale? You could always go back to the US locale. It is *highly* unlikely but it could be possible that that program is getting the code page directly from Windows. – Doktoro Reichard Jun 16 '14 at 11:00
  • I do need the UK locale - I now have a UK keyboard and most of what I do is UK based (metric, pound sign, date formates etc). Actually I think it is getting the code page from Windows - the box properties show the program used as \Windows\System32\ntvdm.exe. So I need to change the code page in Windows I think, without changing the locale – David Jun 16 '14 at 11:34
  • OK, as an experiment I switched back to US locale - now the DOS program works BUT the exit to DOS shell shows the cp to be 1252!!! Regular CMD windows show 437 as expected - I'm, really confused now – David Jun 16 '14 at 12:02
  • Until now, I didn't realize you were actually running an old DOS program (because several people think cmd is the same as DOS). Your program is a 16-bit program. As such, it is being emulated by NTVDM (NT Virtual DOS Machine) and most importantly, it is command.com (not cmd.exe) that is being run. Maybe running the batch through command.com will work, but I don't have experience in the subject. Considering the age, I could also recommend you DOSBox (which is a DOS emulator, commonly used for games). – Doktoro Reichard Jun 16 '14 at 13:40
  • I recommend you to [edit](http://superuser.com/posts/768791/edit) your question, adding all these details that we've discussed in comments. This will bump the question to the front page, where it may gather more interest. I also ask if you could detail more about what program you are trying to run, because it is possible someone else had a similar problem and solved it. I tried to search for `eb.exe`in Google but I didn't find any meaningful results. – Doktoro Reichard Jun 16 '14 at 13:43