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

Add default encoding as UTF-8 #98

Merged
merged 1 commit into from
Jul 15, 2020
Merged

Conversation

thecodelearner
Copy link
Contributor

Default encoding on Windows systems is cp1252
encoding="utf-8" fixes the issue with UnicodeDecodeError when mailmerge_database.csv contains Unicode characters in localized languages.
Thanks to @seshrs and @awdeorio for guiding me through this 😀

@codecov-commenter
Copy link

codecov-commenter commented Jul 14, 2020

Codecov Report

Merging #98 into develop will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop      #98   +/-   ##
========================================
  Coverage    99.03%   99.03%           
========================================
  Files            6        6           
  Lines          311      311           
========================================
  Hits           308      308           
  Misses           3        3           
Impacted Files Coverage Δ
mailmerge/__main__.py 99.21% <100.00%> (ø)

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 20ea7ee...846fd62. Read the comment docs.

@awdeorio
Copy link
Owner

awdeorio commented Jul 15, 2020

Thanks for the PR @thecodelearner ! I don't have access to a windows machine. Could you confirm that the regression tests pass on your machine on this modified branch?

$ pytest

@thecodelearner
Copy link
Contributor Author

thecodelearner commented Jul 15, 2020

one issue:
import sh under mailmerge/tests/test_main.py throws an error since, well, sh is unix only and throws the error "cannot import sh" on windows systems.

log: #97 (comment)

should I also do a neat little raise ImportError on this pr for that?

@thecodelearner
Copy link
Contributor Author

thecodelearner commented Jul 15, 2020

No I don't think raising the error would do anything since all the tests are output to the bash shell with the sh() wrapper.
How do we go around with this?

@awdeorio
Copy link
Owner

Ah, this isn't going to work on Windows. The modern alternative to sh is subprocess.run(). Unfortunately, that function is only supported in recent versions of Python.

I tinkered with running a sanity check on Windows via Travis, but it looks like Python isn't supported on the Travis windows environment.

This is an uncomplicated change, so I'll just merge it in the absence of a way to write a decent unit test.

@awdeorio awdeorio merged commit d08667a into awdeorio:develop Jul 15, 2020
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.

3 participants