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

Specify output_file encoding as utf-8 #364

Merged
merged 4 commits into from
Dec 14, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion bandit/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def main():
)
parser.add_argument(
'-o', '--output', dest='output_file', action='store', nargs='?',
type=argparse.FileType('w'), default=sys.stdout,
type=argparse.FileType('w', encoding='utf-8'), default=sys.stdout,
Copy link
Member

Choose a reason for hiding this comment

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

The encoding parameter wasn't added until Py3.4, but we still want to support Py2.7 at this point.

https://docs.python.org/3/library/argparse.html#filetype-objects

help='write report to filename'
)
parser.add_argument(
Expand Down