-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 property for zip task #405
Conversation
Thanks for the pull request. We'll have someone look at it. In the meantime, can you sign the CLA online at www.gradleware.com/contributor-agreement? |
ok, I've signed it |
Hi. A few things this functionality would require:
Let me know if you want to help out with this. |
@bigdaz I'm not sure we'd need to make this configurable. We should look into making this the default. This would be doable if the current value is always a UTF-8 subset. It's probably not possible if the current value is dependent on platform encoding. |
@bigdaz I prefer configurable way too, and I will do this next. @alkemist I think somebody like me will need this feature in some case. For example, the platform encoding of chinese version Windows is GBK by default, and the files with chinese characters in name could not unpack from war archive if not set zip task encoding to UTF-8. |
@AlphaHinex we don't know what encoding is currently being used. If the current value is the platform encoding, then we can't change to UTF-8. If it however is hardcoded to US-ASCII, then we can. |
@alkemist so we do not hardcode it, we use the platform encoding by default and give user a way to configure it, is it a good idea? |
From the docs of
This makes defaulting/hardcoding to Options:
2 is backwards compatible. 3 is a better default, but potentially breaking. My preference is 3. |
@AlphaHinex Do you mind moving forward on implementing option # 3 above? |
OK, I will try |
Sorry for the long time, but during these days, I've changed my mind. I just add an |
def theZip = new ZipTestFixture(file('build/test.zip'), encoding) | ||
theZip.hasDescendants("${filename}1.txt", "${filename}2.txt", "${filename}3.txt") | ||
} | ||
|
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.
Should use Spock @Unroll
here to avoid test duplication. Would also be useful to have a test explicitly setting null
encoding.
Thanks @AlphaHinex. I think that you are correct to go with keeping the current default behaviour, and making it possible to override with the Before we can merge, we'd need some test coverage for explicitly setting I think the best way to proceed is to close this PR, and open a new one with just the changes required. |
This pr could fix problems such as chinese characters in file name change to garbled characters after using zip type task