Skip to content

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

Merged
thinkingserious merged 4 commits into
sendgrid:masterfrom
rshest:fix-encoding-issues
May 30, 2018
Merged

Provide utf-8 as encoding explicitly when opening text files#414
thinkingserious merged 4 commits into
sendgrid:masterfrom
rshest:fix-encoding-issues

Conversation

@rshest

@rshest rshest commented Oct 23, 2017

Copy link
Copy Markdown
Contributor

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

SendGridDX commented Oct 23, 2017

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov-io

codecov-io commented Oct 23, 2017

Copy link
Copy Markdown

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

gabrielkrell commented Nov 1, 2017

Copy link
Copy Markdown
Contributor

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

rshest commented Nov 1, 2017

Copy link
Copy Markdown
Contributor Author

Good point, thanks. Done :)

@rshest
rshest force-pushed the fix-encoding-issues branch from cc64dc9 to d6d83b5 Compare November 1, 2017 09:01
@mbernier

mbernier commented Nov 3, 2017

Copy link
Copy Markdown
Contributor

@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
Copy Markdown
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

Development

Successfully merging this pull request may close these issues.

7 participants