source: trip-planner-front/node_modules/has-unicode/README.md@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1has-unicode
2===========
3
4Try to guess if your terminal supports unicode
5
6```javascript
7var hasUnicode = require("has-unicode")
8
9if (hasUnicode()) {
10 // the terminal probably has unicode support
11}
12```
13```javascript
14var hasUnicode = require("has-unicode").tryHarder
15hasUnicode(function(unicodeSupported) {
16 if (unicodeSupported) {
17 // the terminal probably has unicode support
18 }
19})
20```
21
22## Detecting Unicode
23
24What we actually detect is UTF-8 support, as that's what Node itself supports.
25If you have a UTF-16 locale then you won't be detected as unicode capable.
26
27### Windows
28
29Since at least Windows 7, `cmd` and `powershell` have been unicode capable,
30but unfortunately even then it's not guaranteed. In many localizations it
31still uses legacy code pages and there's no facility short of running
32programs or linking C++ that will let us detect this. As such, we
33report any Windows installation as NOT unicode capable, and recommend
34that you encourage your users to override this via config.
35
36### Unix Like Operating Systems
37
38We look at the environment variables `LC_ALL`, `LC_CTYPE`, and `LANG` in
39that order. For `LC_ALL` and `LANG`, it looks for `.UTF-8` in the value.
40For `LC_CTYPE` it looks to see if the value is `UTF-8`. This is sufficient
41for most POSIX systems. While locale data can be put in `/etc/locale.conf`
42as well, AFAIK it's always copied into the environment.
43
Note: See TracBrowser for help on using the repository browser.