Show accented characters in a redirect file (> output.txt)

Example

mode con: cp>%tmp%\output.tmp notepad %tmp%\output.tmp 

show:

 Statut du p‚riph‚rique CON: --------------------------- Page de codesÿ: 850 

instead:

 Statut du périphérique CON: --------------------------- Page de codes : 850 

I also tried with chcp 65001 and 1252

Do you know the fix?

Edit:

I use Lucid TrueType Lucida fonts, and even if I do type %tmp%\output.tmp , it shows the correct characters in the console, but not in any text editor.

I also tried:

 cmd /U /C "chcp 65001>nul &mode con: cp>%tmp%\output.tmp" 

and

 cmd /A /C "chcp 65001>nul &mode con: cp>%tmp%\output.tmp" 

without success

+3
source share
2 answers

You can use the / u switch cmd.exe to output Unicode characters. For instance:

 cmd /U /C dir > dirInUnicode.txt 

However, this switch only works with internal commands, so you must use the help file to convert the output of the mode command:

 mode con: cp>%tmp%\output1.tmp cmd /U /C type %tmp%\output1.tmp > %tmp%\output2.tmp 
+4
source

Use PowerShell instead of DOS on the command line. His work is flawless with special characters.

 C:> powershell PS C:> mode con: cp > temp.txt PS C:> notepad temp.txt 
0
source

All Articles