UNPKG

657 BJavaScriptView Raw
1"use strict"
2var os = require("os")
3
4var hasUnicode = module.exports = function () {
5 // Recent Win32 platforms (>XP) CAN support unicode in the console but
6 // don't have to, and in non-english locales often use traditional local
7 // code pages. There's no way, short of windows system calls or execing
8 // the chcp command line program to figure this out. As such, we default
9 // this to false and encourage your users to override it via config if
10 // appropriate.
11 if (os.type() == "Windows_NT") { return false }
12
13 var isUTF8 = /UTF-?8$/i
14 var ctype = process.env.LC_ALL || process.env.LC_CTYPE || process.env.LANG
15 return isUTF8.test(ctype)
16}