Curious effect in Command Prompt "Type" command

In summary, this problem is caused by an older (32 bit) version of Windows and can be solved by changing the "raster fonts" to "Lucida Console".
  • #1
Prophet
18
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
  • #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:
  • #3
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".
 
  • #4
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)
 
  • #5
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:
  • #6
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: 460
  • #7
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:

What is the "Type" command in Command Prompt and how does it work?

The "Type" command in Command Prompt is used to display the contents of a text file onto the screen. It works by reading the contents of the specified file and printing it onto the screen. This can be useful for quickly viewing the contents of a file without having to open it in a separate program.

Why does the "Type" command sometimes show strange characters or symbols?

This is due to the way the command interprets the contents of the text file. If the file contains special characters or formatting, the command may not be able to display it correctly. It is best to use the "Type" command on simple text files to avoid this issue.

Can the "Type" command be used to edit or modify a text file?

No, the "Type" command is only used to display the contents of a file. It cannot be used to edit or modify the file in any way.

Are there any limitations to using the "Type" command?

Yes, the "Type" command can only display text files and has a file size limit of 64 KB. It also cannot display files that are currently in use by another program.

Is there an alternative to the "Type" command for displaying text files?

Yes, the "more" command can also be used to display the contents of a text file in Command Prompt. It has the added functionality of pausing after each page of text, making it easier to read through longer files.

Similar threads

  • Programming and Computer Science
Replies
11
Views
1K
Replies
10
Views
2K
  • Programming and Computer Science
Replies
12
Views
4K
  • Mechanical Engineering
Replies
1
Views
7K
  • Computing and Technology
Replies
14
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Special and General Relativity
Replies
16
Views
2K
Replies
9
Views
1K
  • General Discussion
Replies
7
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
Back
Top