views:

3792

answers:

6

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?

+9  A: 

This was a major issue in PowerShell v1. v2 is shipping with a "graphical shell" that corrects the problem, which is ultimate not with PowerShell but with the Windows console host (which Cmd.exe also uses). You can get the current CTP for PowerShell v2, if you want.

...swooping in with my brand new edit powers

Actually, Powershell v2.0 was finalized and shipped with the release of Windows 7 and 2008 R2 in early August. In addition, the backported versions (Vista/2008) reached their Release Candidate milestone just the other day; XP/2003 should follow very shortly. Linky linky.

Don Jones
Upvoted for suggesting a working solution to the problem. I would accept it, except I'm holding out hope for something better. As "early alpha", it has a long way to go to be a truly usable shell.
Brandon DuRette
The current CTP3 is incredibly stable and, sadly, it's about the only solution out there these days that doesn't involve paying money.
Don Jones
Since this old topic got bumped to the top of the list recently, I edited the primary answer with a link to the latest Powershell bits.
Richard Berg
+1  A: 

for a true shell , try powershell plus. you can select unicode fonts and work with other languages not only in the editor but in the true console

A: 

Have you tried Console 2? Be careful with the colors/palette configurations though. Those are a bit buggy. (Edit: Confirmed to not work. Behaves like cmd.exe).

kimsnarf
On your suggestion, I tried it and it doesn't seem to solve my problem. Running 'dir' in a directory with files that have names that include Korean characters results in ?'s. This behavior is the same as cmd.exe.
Brandon DuRette
Ok. Console2 probably uses the Windows console host as well then, just with a nicer front end.
kimsnarf
+2  A: 

Setting the codepage to UTF-8 with the command "chcp 65001" should help you print file contents correctly to the shell (using cmd.exe). This won't work for directory listings though (UTF-16 encoding in NTFS file names).

kimsnarf
+4  A: 

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)

McDowell
A: 

PowerShell V2 CTP3 inside Console2 seems to do that. The only downside is that the default console encoding is UCS-2 LE instead of UTF-8.

Robin Smidsrød