mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
Filename Encoding issue with Tar #581
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @DisIsAbhi on GitHub (Aug 10, 2023).
Hello, Thanks for working on this repo. Really useful. I have tried to download the Tar file from your Test Archives.
If i use var archive= TarArchive.Open(inputFile) and
foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
{
entry.WriteToDirectory(outputFolder, new ExtractionOptions()
{
ExtractFullPath = true,
Overwrite = true,
PreserveFileTime = true
}));
}
the output looks like this
I have tried ASCII, UNICODE and UTF8 and none of them seem to work.
This begs the question, when opening an archive, how do we make sure that a right ArchiveEncoding is being used?
When we try to open the tar file using 7Zip file manager it is able to display the filename correctly. so if there is anything i am missing with the code here, please let me know.
@adamhathcock commented on GitHub (Aug 10, 2023):
Zip file encoding detection needs improving. Setting it manually seems to be a workaround but not great.
@DisIsAbhi commented on GitHub (Aug 10, 2023):
Thanks. Surprisingly, i have tried the Dotnet7 implementation of tarreader (thanks for contributing to that as well. I have seen your comments)
FileStream archiveStream = File.Open(inputFile, FileMode.Open, FileAccess.Read);
This is what i get from 7Zip.BZip2.7z archive you have provided. Thanks

@DisIsAbhi commented on GitHub (Aug 10, 2023):
Also your repo seems to have filenamedecoder for rar files. do you think it may be useful here?