index.js 657B

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