Try to guess if your terminal supports unicode
npm install has-unicodehas-unicode
===========
Try to guess if your terminal supports unicode
``javascript
var hasUnicode = require("has-unicode")
if (hasUnicode()) {
// the terminal probably has unicode support
}
``javascript`
var hasUnicode = require("has-unicode").tryHarder
hasUnicode(function(unicodeSupported) {
if (unicodeSupported) {
// the terminal probably has unicode support
}
})
What we actually detect is UTF-8 support, as that's what Node itself supports.
If you have a UTF-16 locale then you won't be detected as unicode capable.
Since at least Windows 7, cmd and powershell have been unicode capable,
but unfortunately even then it's not guaranteed. In many localizations it
still uses legacy code pages and there's no facility short of running
programs or linking C++ that will let us detect this. As such, we
report any Windows installation as NOT unicode capable, and recommend
that you encourage your users to override this via config.
We look at the environment variables LC_ALL, LC_CTYPE, and LANG inLC_ALL
that order. For and LANG, it looks for .UTF-8 in the value. LC_CTYPE
For it looks to see if the value is UTF-8. This is sufficient/etc/locale.conf`
for most POSIX systems. While locale data can be put in
as well, AFAIK it's always copied into the environment.