Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list() returns unicode replacement character(�) for unicode filenames on Windows #86

Open
emmercm opened this issue May 16, 2023 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@emmercm
Copy link

emmercm commented May 16, 2023

Given a unicode archive entry name such as:

Brasileirão de Seleções 2020.sfc

Calling 7zip-min.list() will return instead of unicode characters:

Brasileirao de Sele�oes 2020.sfc


I don't see a way to set the encoding of child_process.spawn() that 7zip-min is using, only spawnSync() and exec().

@onikienko
Copy link
Owner

As I remember, by default, node.js expects utf-8 from a child process. I guess, something with Windows. I will take a look at when will have access to the Windows setup.

@onikienko onikienko added the bug Something isn't working label May 17, 2023
@onikienko
Copy link
Owner

I was able to reproduce this issue on Windows 11.

I don't see a way to set the encoding of child_process.spawn() that 7zip-min is using, only spawnSync() and exec().

You may do it by setting childProcess.stdout.setEncoding('utf8'). But it won't help. Since node.js default encoding is utf8.
But Windows uses its own code page.

I can't find a quick solution. Adding cmd /c chcp 65001>nul && before the command is too hacky.

PR to fix this issue is welcome.

@onikienko onikienko added the good first issue Good for newcomers label May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants