11

On Windows 7, dir or tree can't show unicode characters, even starting cmd with cmd /U

So I would press Window Key + R to run something, and type in cmd /U so that the content might handle Unicode.

And then using dir or tree /F, the content in Unicode won't show as Unicode. (in Window Explorer (file manager), the Unicode will show)

Is there a way to handle it? To get Unicode characters to test your filenames, you can go to

http://news.google.com/news?edchanged=1&ned=tw

and you will be able to get many Unicode characters there (UTF-8)

nonopolarity
  • 9,886

4 Answers4

10

Change the font for the console window to a TrueType font, such as Lucida Console or Consolas. With raster fonts you are restricted to the OEm character set.

cmd /u only changes output piped into files, not what you see on screen.

PowerShell by default uses a TrueType font which is why it worked for you.

This has nothing to do with cmd.

Joey
  • 41,098
1

https://stackoverflow.com/questions/10764920/utf-16-on-cmd-exe

  1. Open/run cmd.exe
  2. Click on the icon at the top-left corner
  3. Select properties
  4. Then Font bar
  5. Select Lucida Console and OK.
  6. Write Chcp 10000 at the prompt
  7. Finally dir /b

Also from https://stackoverflow.com/questions/379240/is-there-a-windows-command-shell-that-will-display-unicode-characters/24135341#24135341

  1. CHCP 65001
  2. DIR > UTF8.TXT
  3. TYPE UTF8.TXT
0

Reg file

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Console] "CodePage"=dword:fde9

Command Prompt

REG ADD HKCU\Console /v CodePage /t REG_DWORD /d 0xfde9

PowerShell

sp -t d HKCU:\Console CodePage 0xfde9

Cygwin

regtool set /user/Console/CodePage 0xfde9

0

It's not just a command prompt problem, but a Windows problem in general. The C "wide-character" functions in Windows (namely wprintf) do not support Unicode.

user541686
  • 23,629