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

Provide utf-8 as encoding explicitly when opening text files #414

Merged
merged 4 commits into from May 30, 2018

Conversation

rshest
Copy link
Contributor

@rshest rshest commented Oct 23, 2017

When opening text files in few places, the code relies on system default encoding being set to UTF-8.

This is safe enough in general, but there are certain corner cases like #379, where default one is e.g. ASCII (for whatever reason).

The pull request changes code to use UTF-8 encoding explicitly, without relying on the system defaults.

EDIT: There is another commit fixing a unit test (test_asm_display_group_limit), since that was failing the build, coming from master rebase.

EDIT2: The "reduced" code coverage is because of added import statements - so this is a false positive in fact.

@thinkingserious thinkingserious added the status: code review request requesting a community code review or review from Twilio label Oct 23, 2017
@SendGridDX
Copy link

SendGridDX commented Oct 23, 2017

CLA assistant check
All committers have signed the CLA.

@codecov-io
Copy link

codecov-io commented Oct 23, 2017

Codecov Report

Merging #414 into master will decrease coverage by 0.15%.
The diff coverage is 80%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #414      +/-   ##
==========================================
- Coverage   88.41%   88.26%   -0.16%     
==========================================
  Files          30       30              
  Lines         924      929       +5     
  Branches      110      112       +2     
==========================================
+ Hits          817      820       +3     
  Misses         53       53              
- Partials       54       56       +2
Impacted Files Coverage Δ
sendgrid/helpers/inbound/send.py 93.75% <100%> (+0.2%) ⬆️
sendgrid/helpers/mail/asm.py 84% <66.66%> (-6.48%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 93fc8ce...a4f708f. Read the comment docs.

@gabrielkrell
Copy link
Contributor

gabrielkrell commented Nov 1, 2017

Looks good. You can also do from io import open to make the eventual move to Python 3 (where regular open has an encoding parameter) a little easier (source).

@rshest
Copy link
Contributor Author

rshest commented Nov 1, 2017

Good point, thanks. Done :)

@mbernier
Copy link
Contributor

mbernier commented Nov 3, 2017

@rshest

We have not been able to merge your Pull Request, but because you are awesome - we wanted to make sure you could still get a SendGrid Hacktoberfest shirt.

Please go fill out our swag form before Nov 5th and we will send the shirt! (We know that you might have tried this before and it didn’t work, sorry about that!)

You have till Nov 5th to fill out this form in order to get the Hacktoberfest shirt!

Thank you for contributing during Hacktoberfest! We hope to see you in the repos soon! Just so you know, we always give away a SendGrid shirt for your first ever non-Hacktoberfest PR that gets merged.

@thinkingserious thinkingserious added the type: bug bug in the library label Feb 27, 2018
@thinkingserious thinkingserious merged commit 6097c23 into sendgrid:master May 30, 2018
@thinkingserious
Copy link
Contributor

Hello @rshest,

Thanks again for the PR!

We appreciate your contribution and look forward to continued collaboration. Thanks!

Team SendGrid DX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: medium fix is medium in difficulty status: code review request requesting a community code review or review from Twilio type: bug bug in the library
Projects
None yet
7 participants