codepage() defaults linux
This commit is contained in:
parent
5f1058ded7
commit
5de7801070
16
lib/util.js
16
lib/util.js
@ -260,10 +260,18 @@ function getCodepage() {
|
|||||||
if (_linux || _darwin || _freebsd || _openbsd) {
|
if (_linux || _darwin || _freebsd || _openbsd) {
|
||||||
if (!codepage) {
|
if (!codepage) {
|
||||||
try {
|
try {
|
||||||
const stdout = execSync('echo $LANG');
|
const stdout = execSync('locale charmap');
|
||||||
const lines = stdout.toString().split('\r\n');
|
let lines = stdout.toString().split('\r\n');
|
||||||
const parts = lines[0].split('.');
|
codepage = lines[0].trim();
|
||||||
codepage = parts.length > 1 ? parts[1].trim() : '';
|
if (!codepage) {
|
||||||
|
const stdout = execSync('echo $LANG');
|
||||||
|
lines = stdout.toString().split('\r\n');
|
||||||
|
const parts = lines[0].split('.');
|
||||||
|
codepage = parts.length > 1 ? parts[1].trim() : '';
|
||||||
|
if (!codepage) {
|
||||||
|
codepage = 'UTF-8';
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
codepage = 'UTF-8';
|
codepage = 'UTF-8';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user