-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Unicode stdout on Windows command prompt #7940
Comments
You have to install a Console font that actually has Unicode characters in cmd.exe to actually see them. I recommend DejaVu Sans Mono (http://dejavu-fonts.org/wiki/Main_Page). Install it, edit your registry to get cme.exe to list it as an available font, yadda yadda, and then boom, Unicode characters in cmd.exe! |
That's not really solution though. I can't require everyone to do that. I don't personally use Windows, but I'm tired of being trolled by Windows users about the use of Unicode characters. |
My point is that it's impossible to display those symbols on cmd.exe without the user doing that, because the font that is in the cmd.exe does not have those symbols in it. A program that runs in cmd.exe does not have the power to change the font, either. |
Rather than writing fall backs - perhaps just abandon the check mark symbol entirely for something less succinct (just until that support on Win32 becomes more common). |
Try running |
The problem is that these are fixes each individual node user would have to deploy just to see the correct chars under Windows -- which is, as I understand, what @sindresorhus is trying to avoid. |
I'm not sure what do you expect from a core developers to do in this case? We can't provide working APIs for DNS queries if no DNS servers are reachable, and we can't display unicode properly if the terminal doesn't support it. In fact, people who are using node on windows via Thanks for sharing, though! |
@indutny I wasn't expecting anything. I was hoping there was a way to somehow polyfill it on Windows (like changing the charset programatically or something) like Node (libuv) does with most other things, eg joyent/libuv@68cd6d6. Not being able to use Unicode in the output is very limiting and requiring every user to change the charset isn't feasible. One of the things I love about Node is (mostly) not having to care about platform differences. |
cc @saghul and @orangemocha |
@indutny that's for reading, not writing. For the writing side I see we already use the unicode version: https://github.com/joyent/libuv/blob/master/src/win/tty.c#L959. @sindresorhus Is this a problem in cmd.exe or in any terminal? Does what @TooTallNate said avoid the problem? If so maybe you could execSync it? Or perhaps use a tiny binary addon which does it? |
I haven't tried all the Windows terminals, but neither cmd.exe nor PowerShell seems to display this correctly.
No, but from researching this it might be because the Lucida Console font doesn't support that glyph. On other systems you can use unsupported glyphs which just falls back to the system default, but this doesn't seem to be the case on Windows. Similar Python issue: http://bugs.python.org/issue1602 |
You can't change anything with I agree that it's unreasonable to expect each individual node user changing something. Therefore you have to use a Windows-supported character of a similar shape (such as See some Mocha source code for example. |
@Mithgol I came to that conclusion too. Just annoying as that's very limiting. I ended up doing https://github.com/sindresorhus/figures for my own usecase. |
@sindresorhus Well, theoretically speaking, you could also But some end users might hate you for that. (I definitely would.) |
When I call In my option, I think the code and the text input can be other charset. Before node execute it, the code and the text input convert to utf8. For output, also can add a wrapper to convert utf8 to using charset. PS:In Windows, |
With Node.js 0.10.28 running the following:
node -e "process.stdout.write('✔');"
Outputs
✔
on OS X, but only shows the following on Windows 8.1 command prompt:It would be very useful if Unicode characters would show on Windows too. Right now I have to implement annoying fallbacks for Windows.
The text was updated successfully, but these errors were encountered: