Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Curious effect in Command Prompt "Type" command

  1. Jun 30, 2017 #1
    I create a text file using notepad or any other text editor or word processor. There is a hyphen in the file. If I then display that file using the TYPE command in the Command Prompt then that hyphen gets replaced with a lower case u with a GRAVE symbol over it. What's going on?

    No big deal. Just a curious effect.
  2. jcsd
  3. Jun 30, 2017 #2
    Dashes are often mistaken for hyphens, and visa versa.
    "Em dash" is ù (keyboard shortcut Alt 151).
    "En dash" is û (keyboard shortcut Alt 150).
    Hypnen-minus is what is on your keyboard.

    When in doubt, open the file with a hex editor/viewer, and see what value is used to represent the mystery special character. The DEBUG command will work in a pinch (use 'D' to dump file contents to the screen)..
    Last edited: Jun 30, 2017
  4. Jul 1, 2017 #3


    User Avatar
    Science Advisor
    Gold Member

    Chances are that you are using an older (32 bit) version of Windows (the command runs perfectly in newer 64 bit versions). Now, it turns out that this is usually not a code page problem but a font problem. Try to change "raster fonts" to "Lucida Console".
  5. Jul 1, 2017 #4
    It is a code page version and not a font problem, nor a windows version problem.
    It will still happen with windows 10, 64 bits and the same font in both notepad and the console.
    The command prompt uses code page 850 (old ibm compatible ascii + block graphics stuff) and most windows programs use code page 1252.
    Use chcp in a command prompt to change this or the ChangeConsoleCP Winapi function in a program that outputs to a console, and you get all those different dashes. (if the they are in the font you use, but all the fonts you can use in the console in windows 10 seem to have them)
  6. Jul 2, 2017 #5


    User Avatar
    Science Advisor
    Gold Member

    I advise you not to be so sure about that. At least to my understanding of the description of the problem, it is not a code page problem. I have successfully solved it for myself.

    I don't know about Windows 10 (I can't check it right now) but in Windows 8.1, 64 bits runs without any kind of problem. The hyphen prints in the console perfectly.

    This does not solve the display problem.
    Last edited: Jul 2, 2017
  7. Jul 2, 2017 #6


    Attached Files:

  8. Jul 2, 2017 #7


    User Avatar
    Science Advisor
    Gold Member

    In a similar situation for me this didn't work. I hope that I'm clear enough. I could upload snapshots as well but let the OP say which one solves his problem.

    EDIT: Also, in order to have a more complete picture of the problem, it would be helpful if @Prophet can tell us which version of Windows is running.
    Last edited: Jul 2, 2017
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted