ZJONSSON / node-unzipper

node.js cross-platform unzip using streams
Other
424 stars 114 forks source link

Issue with Incorrect Character Display in `fileName` #290

Closed mathmartins-sb closed 2 months ago

mathmartins-sb commented 5 months ago

Issue with Incorrect Character Display in fileName

Problem Description:

When using the unzipper library to extract files from a ZIP archive, the fileName variable is displaying incorrect characters for accented characters such as á, ç, ã, etc. Someone knows how to solve?

Example Code:


import unzipper from 'unzipper';
import fs from 'fs';

fs.createReadStream('./teste.zip')
  .pipe(unzipper.Parse())
  .on('entry', function (entry) {
    const fileName = entry.path;
    const type = entry.type; // 'Directory' or 'File'
    const size = entry.vars.uncompressedSize; // There is also compressedSize;
    console.log('using unzipper');
    console.log(fileName);
  });
ZJONSSON commented 2 months ago

test.zip @mathmartins-sb I just created a test zip file with accented characters (attached) and I did get back the accented characters both with the .pipe(unzipper.Parse()) as well as the .Open methods. Are you sure the problem is not with the process that wrote this zip files originally? If not can you please reopen and share a sample zip file that is problematic for you

ZJONSSON commented 2 months ago

image