node-ci-info/is-unicode-supported
zhouganqing 24739b1998 Import Upstream version 3.2.0+~cs4.2.0 2023-02-17 09:41:43 +08:00
..
.github/workflows Import Upstream version 3.2.0+~cs4.2.0 2023-02-17 09:41:43 +08:00
.editorconfig Import Upstream version 3.2.0+~cs4.2.0 2023-02-17 09:41:43 +08:00
.gitattributes Import Upstream version 3.2.0+~cs4.2.0 2023-02-17 09:41:43 +08:00
.gitignore Import Upstream version 3.2.0+~cs4.2.0 2023-02-17 09:41:43 +08:00
.npmrc Import Upstream version 3.2.0+~cs4.2.0 2023-02-17 09:41:43 +08:00
index.d.ts Import Upstream version 3.2.0+~cs4.2.0 2023-02-17 09:41:43 +08:00
index.js Import Upstream version 3.2.0+~cs4.2.0 2023-02-17 09:41:43 +08:00
index.test-d.ts Import Upstream version 3.2.0+~cs4.2.0 2023-02-17 09:41:43 +08:00
license Import Upstream version 3.2.0+~cs4.2.0 2023-02-17 09:41:43 +08:00
package.json Import Upstream version 3.2.0+~cs4.2.0 2023-02-17 09:41:43 +08:00
readme.md Import Upstream version 3.2.0+~cs4.2.0 2023-02-17 09:41:43 +08:00
test.js Import Upstream version 3.2.0+~cs4.2.0 2023-02-17 09:41:43 +08:00

readme.md

is-unicode-supported

Detect whether the terminal supports Unicode

This can be useful to decide whether to use Unicode characters or fallback ASCII characters in command-line output.

Note that the check is quite naive. It just assumes all non-Windows terminals support Unicode and hard-codes which Windows terminals that do support Unicode. However, I have been using this logic in some popular packages for years without problems.

Install

$ npm install is-unicode-supported

Usage

const isUnicodeSupported = require('is-unicode-supported');

isUnicodeSupported();
//=> true

API

isUnicodeSupported()

Returns a boolean for whether the terminal supports Unicode.