-
Notifications
You must be signed in to change notification settings - Fork 979
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
add encoding parameter to creating tar entry #364
Conversation
default is same as current master behavior(omit upper byte)
Codacy says " |
The problem right now with Codacy is that the current code is way beyond bad. |
As stated in #182: This should be fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great implementation, my argument name change suggestion resulted in 40+ changes, hope that doesn't seem to daunting (was meant as a quick way to use the suggestions).
As for the defaults, I would mark the encoding-less constructors as
[Obsolete("No Encoding for Name field is specified, any non-ASCII bytes will be discarded")]
And on that note, the behaviour of passing null
as the encoding is not specified. It should be documented.
And one last thing. The test does only test for UTF-8 in, UTF-8 out. It does not verify the actual bytes in the name. The reason for testing this is that Encoding.UTF8
emits BOM, which I don't think we want in the name bytes (but I can be wrong here, I will check what GNU Tar does).
If, instead, UTF8Encoding()
is used, it will not emit any BOM. Maybe we should guide the consumer to making the right choice here as well?
Thanks for your contribution!
Thank you for reviewing, I'd like to reflect the review results.
Should it be written on README or API comment?
Asserting raw bytes of name is necessary, I will add. |
Regarding documentation: Regarding Encoding.UTF8: |
…harpcode#364) but IEntryFactory does not considering name encoding.
@piksel I've almost done with requested changes, please review it. |
This PR is similar to #182, but this PR adds System.Text.Encoding to TarEntry related API.
default is same as current master behavior(omit upper byte) because more faster than using encoding if tar archive assured having ASCII filename only.
I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the SharpZipLib open source product (the "Contribution"). My Contribution is licensed under the MIT License.