Chinese Garbled #269

Open
opened 2026-01-29 22:09:18 +00:00 by claunia · 19 comments
Owner

Originally created by @JohnnyWoong on GitHub (Jan 8, 2018).

when i use it, the chinese will be garbled

Originally created by @JohnnyWoong on GitHub (Jan 8, 2018). when i use it, the chinese will be garbled
claunia added the bugup for grabs labels 2026-01-29 22:09:18 +00:00
Author
Owner

@JohnnyWoong commented on GitHub (Jan 8, 2018):

uncompress zip, file extension is jpg

@JohnnyWoong commented on GitHub (Jan 8, 2018): uncompress zip, file extension is jpg
Author
Owner

@adamhathcock commented on GitHub (Jan 8, 2018):

Try setting the encoding on the options.

@adamhathcock commented on GitHub (Jan 8, 2018): Try setting the encoding on the options.
Author
Owner

@JohnnyWoong commented on GitHub (Jan 8, 2018):

useless,the default setting is utf-8

@JohnnyWoong commented on GitHub (Jan 8, 2018): useless,the default setting is utf-8
Author
Owner

@adamhathcock commented on GitHub (Jan 8, 2018):

yeah it is...set it to a different code page

@adamhathcock commented on GitHub (Jan 8, 2018): yeah it is...set it to a different code page
Author
Owner

@JohnnyWoong commented on GitHub (Jan 8, 2018):

what do u mean?set to encode.default?

@JohnnyWoong commented on GitHub (Jan 8, 2018): what do u mean?set to encode.default?
Author
Owner

@adamhathcock commented on GitHub (Jan 8, 2018):

https://github.com/adamhathcock/sharpcompress/issues/149 is similar

there still might need to be code changes to totally fix things

@adamhathcock commented on GitHub (Jan 8, 2018): https://github.com/adamhathcock/sharpcompress/issues/149 is similar there still might need to be code changes to totally fix things
Author
Owner

@JohnnyWoong commented on GitHub (Jan 8, 2018):

ok,i will try that first,thx

@JohnnyWoong commented on GitHub (Jan 8, 2018): ok,i will try that first,thx
Author
Owner

@JohnnyWoong commented on GitHub (Jan 8, 2018):

y i can delete zip file after i uncompress it,but cant delete 7z file after i uncompress it?

@JohnnyWoong commented on GitHub (Jan 8, 2018): y i can delete zip file after i uncompress it,but cant delete 7z file after i uncompress it?
Author
Owner

@adamhathcock commented on GitHub (Jan 8, 2018):

make sure everything is disposed. You'll need to show me a code sample of what you're doing if you think you've disposed everything

@adamhathcock commented on GitHub (Jan 8, 2018): make sure everything is disposed. You'll need to show me a code sample of what you're doing if you think you've disposed everything
Author
Owner

@JohnnyWoong commented on GitHub (Jan 8, 2018):

//zip uncompress and delete
using (var archive = ZipArchive.Open(file))
            {
                foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
                {
                    entry.WriteToDirectory(folder, new ExtractionOptions()
                    {
                        ExtractFullPath = true,
                        Overwrite = true
                    });
                }
            }
File.Delete(file);
//7zip uncompress and delete
using (var archive = RarArchive.Open(file))
            {
                foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
                {
                    entry.WriteToDirectory(folder, new ExtractionOptions()
                    {
                        ExtractFullPath = true,
                        Overwrite = true
                    });
                }
            }
File.Delete(file);

@JohnnyWoong commented on GitHub (Jan 8, 2018): ```c# //zip uncompress and delete using (var archive = ZipArchive.Open(file)) { foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory)) { entry.WriteToDirectory(folder, new ExtractionOptions() { ExtractFullPath = true, Overwrite = true }); } } File.Delete(file); //7zip uncompress and delete using (var archive = RarArchive.Open(file)) { foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory)) { entry.WriteToDirectory(folder, new ExtractionOptions() { ExtractFullPath = true, Overwrite = true }); } } File.Delete(file); ```
Author
Owner

@adamhathcock commented on GitHub (Jan 8, 2018):

I'll take a look later but RarArchive isn't 7Zip

@adamhathcock commented on GitHub (Jan 8, 2018): I'll take a look later but `RarArchive` isn't 7Zip
Author
Owner

@JohnnyWoong commented on GitHub (Jan 8, 2018):

sry,my copy wrong,RarArchive should be SevenZipArchive,the 7z file cant delete,i haven't test rar file

@JohnnyWoong commented on GitHub (Jan 8, 2018): sry,my copy wrong,RarArchive should be SevenZipArchive,the 7z file cant delete,i haven't test rar file
Author
Owner

@adamhathcock commented on GitHub (Jan 8, 2018):

well, I need the exact code, not a copy/guess. As far as I can tell, disposal works correctly.

@adamhathcock commented on GitHub (Jan 8, 2018): well, I need the exact code, not a copy/guess. As far as I can tell, disposal works correctly.
Author
Owner

@JohnnyWoong commented on GitHub (Jan 8, 2018):

using (var archive = SevenZipArchive.Open(file))
            {
                foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
                {
                    entry.WriteToDirectory(folder, new ExtractionOptions()
                    {
                        ExtractFullPath = true,
                        Overwrite = true
                    });
                }
            }
File.Delete(file);

thats is the code,cause i write 7z,zip and rar,so i copy the wrong one..

@JohnnyWoong commented on GitHub (Jan 8, 2018): ```c# using (var archive = SevenZipArchive.Open(file)) { foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory)) { entry.WriteToDirectory(folder, new ExtractionOptions() { ExtractFullPath = true, Overwrite = true }); } } File.Delete(file); ``` thats is the code,cause i write 7z,zip and rar,so i copy the wrong one..
Author
Owner

@adamhathcock commented on GitHub (Jan 8, 2018):

I literally tested that and it works for me. Next step for debugging would be for you to provide a github repo sample with the bug that I could validate didn't work.

@adamhathcock commented on GitHub (Jan 8, 2018): I literally tested that and it works for me. Next step for debugging would be for you to provide a github repo sample with the bug that I could validate didn't work.
Author
Owner

@JohnnyWoong commented on GitHub (Jan 9, 2018):

I dont knw y,but same code is work 4 me today...sry abt that
By the way,7z uncompress is too slow,250MB zip uncompress only need less 1 min,y 275MB 7z uncompress need about 30M..

@JohnnyWoong commented on GitHub (Jan 9, 2018): I dont knw y,but same code is work 4 me today...sry abt that By the way,7z uncompress is too slow,250MB zip uncompress only need less 1 min,y 275MB 7z uncompress need about 30M..
Author
Owner

@binary4cat commented on GitHub (Sep 19, 2018):

@JohnnyWongC How do you solve this Chinese garbled problem? 😱

@binary4cat commented on GitHub (Sep 19, 2018): @JohnnyWongC How do you solve this Chinese garbled problem? 😱
Author
Owner

@JohnnyWoong commented on GitHub (Nov 13, 2018):

I literally tested that and it works for me. Next step for debugging would be for you to provide a github repo sample with the bug that I could validate didn't work.

I test it again,some file can unzip correctly,some file still garbled

test file.zip: https://www.jianguoyun.com/p/DavrLy0Q-c3-BRjQroMB
the chinese file in mods directory

protected static void ZipUncompress(string file, string folder)
{
    using (var archive = ZipArchive.Open(file))
    {
        foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
        {
            entry.WriteToDirectory(folder, new ExtractionOptions()
            {
                ExtractFullPath = true,
                Overwrite = true
            });
        }
    }
}
@JohnnyWoong commented on GitHub (Nov 13, 2018): > I literally tested that and it works for me. Next step for debugging would be for you to provide a github repo sample with the bug that I could validate didn't work. I test it again,some file can unzip correctly,some file still garbled test file.zip: https://www.jianguoyun.com/p/DavrLy0Q-c3-BRjQroMB the chinese file in mods directory ```c# protected static void ZipUncompress(string file, string folder) { using (var archive = ZipArchive.Open(file)) { foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory)) { entry.WriteToDirectory(folder, new ExtractionOptions() { ExtractFullPath = true, Overwrite = true }); } } } ```
Author
Owner

@YoungLiao commented on GitHub (Sep 27, 2022):

not fixed on version 0.32.2 yet.

@YoungLiao commented on GitHub (Sep 27, 2022): not fixed on version 0.32.2 yet.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#269