Curious effect in Command Prompt "Type" command

  • Thread starter Thread starter Prophet
  • Start date Start date
  • Tags Tags
    Curious Type
Click For Summary
The issue described involves a hyphen in a text file being displayed as a lowercase 'u' with a grave accent when using the TYPE command in Command Prompt. This phenomenon is attributed to the differences in code pages and font rendering between the text editor and the console. The Command Prompt typically uses code page 850, while most Windows applications use code page 1252. Changing the console's font to "Lucida Console" may help, but the problem persists across different Windows versions, including 64-bit systems. The use of the chcp command can alter the code page settings, potentially resolving the display issue, but results may vary. A hex editor can be used to investigate the character encoding further.
Prophet
Messages
18
Reaction score
0
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.
 
Computer science news on Phys.org
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:
Prophet said:
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.

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".
 
QuantumQuest said:
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".

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)
 
willem2 said:
It is a code page version and not a font problem, nor a windows version problem.

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.

willem2 said:
It will still happen with windows 10, 64 bits and the same font in both notepad and the console.

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.

willem2 said:
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.

This does not solve the display problem.
 
Last edited:
QuantumQuest said:
This does not solve the display problem.

No?

upload_2017-7-2_16-56-13.png
 

Attachments

  • upload_2017-7-2_16-55-42.png
    upload_2017-7-2_16-55-42.png
    14.4 KB · Views: 525
No?

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:

Similar threads

  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
10
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 7 ·
Replies
7
Views
9K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
1
Views
2K
  • · Replies 14 ·
Replies
14
Views
5K