This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
TripSit_Suite/node_modules/has-unicode
cranberry ed23347e56 Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
..
LICENSE Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
README.md Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
index.js Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
package.json Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00

README.md

has-unicode

Try to guess if your terminal supports unicode

var hasUnicode = require("has-unicode")

if (hasUnicode()) {
  // the terminal probably has unicode support
}
var hasUnicode = require("has-unicode").tryHarder
hasUnicode(function(unicodeSupported) {
  if (unicodeSupported) {
    // the terminal probably has unicode support
  }
})

Detecting Unicode

What we actually detect is UTF-8 support, as thats what Node itself supports. If you have a UTF-16 locale then you wont be detected as unicode capable.

Windows

Since at least Windows 7, cmd and powershell have been unicode capable, but unfortunately even then its not guaranteed. In many localizations it still uses legacy code pages and theres 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.

Unix Like Operating Systems

We look at the environment variables LC_ALL, LC_CTYPE, and LANG in that order. For LC_ALL and LANG, it looks for .UTF-8 in the value. For LC_CTYPE it looks to see if the value is UTF-8. This is sufficient for most POSIX systems. While locale data can be put in /etc/locale.conf as well, AFAIK its always copied into the environment.