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 encoding to use utf-8 #84

Merged
merged 1 commit into from
Oct 28, 2019
Merged

Fix encoding to use utf-8 #84

merged 1 commit into from
Oct 28, 2019

Conversation

roaldnefs
Copy link
Member

Fix encoding to use utf-8 by default in Python 2, the default encoding in Python 3 is already utf-8. This fix will wrap sys.stdout in a object that automatically encodes an unicode string into utf-8, in Python 2 only.

An alternative to this would be to set the PYTHONIOENCODING='utf-8' environment variable before running salt-lint, but this would require an extra action on the user side.

The old solution using str.encode('utf-8') caused byte string (e.g. b'') output in Python 3...

Fixes #74.

Fix encoding to use utf-8 by default in Python 2, the default encoding
in Python 3 is already utf-8. This fix will wrap `sys.stdout` in a
object that automatically encodes an unicode string into utf-8, in
Python 2 only.

An alternative to this would be to set the `PYTHONIOENCODING='utf-8'`
environment variable before running `salt-lint`, but this would require
an extra action on the user side.

The old solution using `str.encode('utf-8')` caused byte string (e.g.
`b''`) output in Python 3...

Fixes #74.

Signed-off-by: Roald Nefs <roald@warpnet.nl>
@roaldnefs roaldnefs merged commit 6ddf634 into develop Oct 28, 2019
@roaldnefs roaldnefs deleted the fix/encoding branch October 31, 2019 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants