Powershell – Windows command shell that will display Unicode characters

powershellunicode

Assuming I have fonts installed which have the appropriate glyphs in them, is there a command shell for Windows XP that will display Unicode characters? At a minimum, two things that should display Unicode correctly:

  • Directory listings. I don't care what I have to type (dir, ls, get-childitem, etc.), so long as files with Unicode characters in their names appear with the right glyphs, not the unprintable character box.
  • Text file content listings. Again, doesn't matter to me if it's 'less', 'more', 'cat', 'dog', etc., so long as the characters are printed. I recognize that this is more complicated because of character encoding of the file, so if I have to specify that on the command line that's fine with me.

Here's what I've tried so far:

  • cmd.exe
  • Windows PowerShell; including the multilingual version.
  • Cygwin bash

No luck. I even tried installing custom fonts for cmd/PowerShell. PowerShell and cmd.exe seem to be Unicode-aware in the sense that I can copy/paste the non-printable box out of there and it will paste into other apps with the correct characters. Cygwin (?) seems to convert to the ? character and that comes through in the copy/paste.

Any ideas?

Best Answer

To do this with cmd.exe, you'll need to use the console properties dialog to switch to a Unicode TrueType font.

Then use these commands:

 CHCP 65001
 DIR > UTF8.TXT
 TYPE UTF8.TXT

Commands:

  • Switch console to UTF-8 (65001)
  • Redirect output of DIR to UTF8.TXT
  • Dump UTF-8 to console

The characters will still need to be supported by the font to display properly on the console.

I18N: Unicode at the Windows command prompt (C++; .Net; Java)