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

fix: fall back to 'charset' of 'content_type' in 'download_as_text' #326

Merged
merged 3 commits into from Nov 30, 2020

Conversation

tseaver
Copy link
Contributor

@tseaver tseaver commented Nov 24, 2020

Explicit 'encoding' overrides the fallback.

Use the 'charset' param of 'content_type', rather than 'content_encoding',
which isn't going to be a Unicode -> bytes encoding.

Closes #319.

@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Nov 24, 2020
@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/python-storage API. label Nov 24, 2020
@tseaver
Copy link
Contributor Author

tseaver commented Nov 24, 2020

Note for reviewers: the first commit (d4ee030) is the meat of the PR. The second one (0f434fb) is just rewrapping long / overindented docstring params for readability within the source.

Explicit 'encoding' overrides the fallback.

Use the 'charset' param of 'content_type', rather than 'content_encoding',
which isn't going to be a Unicode -> bytes encoding.

Closes #319.
Improve in-source readability.
@tseaver tseaver force-pushed the 319-blob-download_as_text-cannot-use-content_encoding branch from 30d2dc1 to 3801122 Compare November 24, 2020 22:41
Copy link
Contributor

@tswast tswast left a comment

Choose a reason for hiding this comment

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

LGTM for Python readability. Thanks for adding clear tests for this case (no explicit encode, but with a charset in the content-type header)

@tseaver tseaver merged commit 63ff233 into master Nov 30, 2020
@tseaver tseaver deleted the 319-blob-download_as_text-cannot-use-content_encoding branch November 30, 2020 18:07
cojenco pushed a commit to cojenco/python-storage that referenced this pull request Oct 13, 2021
…oogleapis#326)

Explicit 'encoding' overrides the fallback.

Use the 'charset' param of 'content_type', rather than 'content_encoding',
which isn't going to be a Unicode -> bytes encoding.

Closes googleapis#319.

Also, rewrap long param descriptions for in-source readability.
cojenco pushed a commit to cojenco/python-storage that referenced this pull request Oct 13, 2021
…oogleapis#326)

Explicit 'encoding' overrides the fallback.

Use the 'charset' param of 'content_type', rather than 'content_encoding',
which isn't going to be a Unicode -> bytes encoding.

Closes googleapis#319.

Also, rewrap long param descriptions for in-source readability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/python-storage API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blob.download_as_text does not decode properly
2 participants