Skip to content

I think we need the IsUnicodeText property in TarEntry #156

Closed

Description

@lystormenvoy

Steps to reproduce

1.I pack a tar.gz use SharpZipLib
2.Some filenames contain Chinese character
3.So the filenames in tar.gz are wrong

Expected behavior

Tell us what should happen
Zip file has IsUnicodeText property to resolve this issue(I have no test), I think tar need too.

Actual behavior

Tell us what happens instead

Version of SharpZipLib

0.86.0.518

Obtained from (place an x between the brackets for all that apply)

  • Downloaded DLL from Nuget

Activity

  1. jhudsoncedaron commented on Aug 28, 2018

    @jhudsoncedaron

    You got bit pretty hard man. It turns out there is no such property because tar archives don't have it.

    The world moved two decades ago to unix filesystems store names in UTF-8; however this isn't actually enforced by anything.

  2. yuzd commented on Jul 28, 2019

    @yuzd

    i have this question too..
    have anybody have solution for this?

  3. piksel commented on Jul 29, 2019

    @piksel
    Member

    There are PRs for allowing the TAR filename encoding to be specified (#364 #182), but I currently don't want to merge any more features before 1.2 is released, but one of them will probably land in 1.3

  4. lystormenvoy commented on Jul 30, 2019

    @lystormenvoy
    Author

    i have this question too..
    have anybody have solution for this?

            /// <summary>  
            /// 生成 ***.tar.gz 文件  
            /// </summary>  
            /// <param name="strBasePath">文件基目录(源文件、生成文件所在目录)</param>  
            /// <param name="TarFileName">tar.gz压缩包名</param>  
            public bool CreatTarGzArchive(string strBasePath, string TarFileName)
            {
                if (string.IsNullOrEmpty(strBasePath)
                    || !System.IO.Directory.Exists(strBasePath))
                {
                    return false;
                }
                Environment.CurrentDirectory = strBasePath;
                Stream outTmpStream = new FileStream(TarFileName, FileMode.Create);
                Stream outStream = new GZipOutputStream(outTmpStream);
                TarArchive archive = TarArchive.CreateOutputTarArchive(outStream, TarBuffer.DefaultBlockFactor);
                TarEntry entry = TarEntry.CreateEntryFromFile(strBasePath + "webapps");
                archive.WriteEntry(entry, true);
    
                if (archive != null)
                {
                    archive.Close();
                }
                outTmpStream.Close();
                outStream.Close();
                Environment.CurrentDirectory = "\\";
                return true;
            }
    

    这是我的代码,要打包strBasePath下面的webapps进压缩包。
    看起来没有问题,中文不会乱码。

  5. yuzd commented on Jul 30, 2019

    @yuzd

    @lystormenvoy
    在windows系统上没有出现乱码
    但在mac上运行的时候如果文件夹名称含有中文发现会乱码。改成ZIP没事

  6. lystormenvoy commented on Jul 30, 2019

    @lystormenvoy
    Author

    @lystormenvoy
    在windows系统上没有出现乱码
    但在mac上运行的时候如果文件夹名称含有中文发现会乱码。改成ZIP没事

    这就不知道了,这玩意还能用在mac?

  7. yuzd commented on Jul 30, 2019

    @yuzd

    @lystormenvoy
    可以的,netcore下跨平台嘛

  8. lystormenvoy commented on Aug 5, 2019

    @lystormenvoy
    Author

    @lystormenvoy
    可以的,netcore下跨平台嘛

    今天看了下,发现打包是没有乱码,但是在Linux下面解压出来还是有问题

  9. lystormenvoy commented on Aug 5, 2019

    @lystormenvoy
    Author
  10. yuzd commented on Aug 5, 2019

    @yuzd

    你可以提个pr

  11. thecristidima commented on Oct 15, 2019

    @thecristidima

    There are PRs for allowing the TAR filename encoding to be specified (#364 #182), but I currently don't want to merge any more features before 1.2 is released, but one of them will probably land in 1.3

    Any updates regarding this issue? We've just recently run into this issue and it seems the PRs have been (mostly) ignored.

  12. Numpsy commented on Jul 13, 2020

    @Numpsy
    Contributor

    Was this handled by merging #364 ?

  13. piksel commented on Jul 15, 2020

    @piksel
    Member

    Indeed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions