Add support for other charsets than utf-8 for output (for executable anyway)
This commit is contained in:
parent
73abf0cb01
commit
a220f76ca9
|
|
@ -66,6 +66,7 @@ You need to pass an argument to this option to specify the name that your module
|
||||||
.describe("V", "Print version number and exit.")
|
.describe("V", "Print version number and exit.")
|
||||||
.describe("noerr", "Don't throw an error for unknown options in -c, -b or -m.")
|
.describe("noerr", "Don't throw an error for unknown options in -c, -b or -m.")
|
||||||
.describe("charset-input", "Charset of input (default utf-8)")
|
.describe("charset-input", "Charset of input (default utf-8)")
|
||||||
|
.describe("charset-output", "Charset of output (default utf-8)")
|
||||||
|
|
||||||
.alias("p", "prefix")
|
.alias("p", "prefix")
|
||||||
.alias("o", "output")
|
.alias("o", "output")
|
||||||
|
|
@ -370,9 +371,13 @@ async.eachLimit(files, 1, function (file, cb) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OUTPUT_FILE) {
|
if (OUTPUT_FILE) {
|
||||||
fs.writeFileSync(OUTPUT_FILE, output, "utf8");
|
if(ARGS.charset_output) {
|
||||||
|
fs.writeFileSync(OUTPUT_FILE, iconv.encode(output, ARGS.charset_output));
|
||||||
} else {
|
} else {
|
||||||
sys.print(output);
|
fs.writeFileSync(OUTPUT_FILE, output, "utf8");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sys.print(ARGS.charset_output ? iconv.encode(output, ARGS.charset_output) : output);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ARGS.stats) {
|
if (ARGS.stats) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user