Skip to content
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

encode/decode UTF-8 in POMs #44

Merged
merged 2 commits into from Mar 20, 2017
Merged

encode/decode UTF-8 in POMs #44

merged 2 commits into from Mar 20, 2017

Conversation

alpo
Copy link
Contributor

@alpo alpo commented Mar 19, 2017

Issue #43
Works for me. Tests are passed.

@baztian baztian self-requested a review March 19, 2017 18:03
@baztian baztian self-assigned this Mar 19, 2017
Copy link
Contributor

@baztian baztian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, excellent work!
Can you please consider my review notes.

jip/util.py Outdated
@@ -71,6 +71,7 @@ def download_string(url):
import requests
try:
response = requests.get(url, headers={ 'User-Agent': JIP_USER_AGENT})
response.encoding = 'utf-8'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to be required. I don't think it makes any sense to modify the response that comes from the server.

Copy link
Contributor Author

@alpo alpo Mar 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's a dubious operation, but Maven repository gives UTF-8 encoded files without content encoding header, so the 'requests' incorrectly assigns the 'iso-8859-1' encoding.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. But it doesn't seem to matter what 'requests' assigns. I've tried the code without setting the encoding attribute and it works. I think it is just metadata about the response that you can query if you want. But it doesn't affect how the data is interpreted.

@@ -18,6 +18,11 @@ def testResolve(self):
artifacts = _resolve_artifacts([junit])
self.assertEqual(len(artifacts), 1)

def testResolve2(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please give the test method a more meaningful name? Like testResolveArtifactWithUmlautsInPom or so?

@@ -18,6 +18,11 @@ def testResolve(self):
artifacts = _resolve_artifacts([junit])
self.assertEqual(len(artifacts), 1)

def testResolve2(self):
junit = Artifact('de.l3s.boilerpipe', 'boilerpipe', '1.1.0')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename the variable junit

Copy link
Contributor

@baztian baztian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, perfect!

@baztian baztian merged commit 67cb2f5 into jiptool:master Mar 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants