Open luuman opened 3 years ago
const compressing = require('compressing');
const result = await compressing.zip.uncompress(file, unpackDir, { zipFileNameEncoding: 'GBK' });
The only solution: use English, that's all! Using Chinese in the wrong place will make you lower yourself.
Where is the correct place for using Chinese?
use JSZip to load data and write data into file system.
The only solution: use English, that's all! Using Chinese in the wrong place will make you lower yourself.
Where is the correct place for using Chinese?
LOL so why don't you answer him in Chinese but in English? Don't you find yourself ridiculous? My answer was in your comment.
The only solution: use English, that's all! Using Chinese in the wrong place will make you lower yourself.
Where is the correct place for using Chinese?
LOL so why don't you answer him in Chinese but in English? Don't you find yourself ridiculous? My answer was in your comment.
I'm worried about your brain cannot handle Chinese. Pity you and help you understand.
The only solution: use English, that's all! Using Chinese in the wrong place will make you lower yourself.
Where is the correct place for using Chinese?
LOL so why don't you answer him in Chinese but in English? Don't you find yourself ridiculous? My answer was in your comment.
I'm worried about your brain cannot handle Chinese. Pity you and help you understand.
Be superior in your own Chinese home, please! Nobody cares about your language, so you don't have to show others that you're a clown. Why do I need to handle Chinese? To be a clown like you? LMAO
抄个代码还受到了歧视,我也换一个好啦
抄个代码还受到了歧视,我也换一个好啦
它又不是开发者,就一没脑子的傻卵罢了
yauzl
use cp437
encoding, you can find it here https://github.com/thejoshwolfe/yauzl/blob/master/index.js#L757
so you can do something like below
const extract = require("extract-zip");
const iconv = require('iconv-lite')
const cp437 = '\u0000☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ '
function decodeCp437(str) {
const buffArr = []
for (const s of str) {
buffArr.push(cp437.indexOf(s))
}
return Buffer.from(buffArr)
}
extract(
'special encoding file name.zip',
{
dir: 'your unzip dir',
onEntry: function (entry) {
// decode
entry.fileName = iconv.decode(decodeCp437(entry.fileName), 'special encoding')
}
}
)
.then(() => { })
the solution is not so good because it did something opposite to yauzl
But you can use it as a temporary solution before extract-zip
supports decodeStrings
what "special encoding" should i set, tried 'GBK' is not working. @KirrsGool
ZIP format do not contain the encoding information of the file names, you need determine it by yourself or detect it (for Simplified Chinese it may be GBK
).
ZIP 格式没有包含文件名的编码信息, 你需要自行决定或者探测解压时使用的编码, 简体中文一般是 GBK
.
The only solution: use English, that's all! Using Chinese in the wrong place will make you lower yourself.