From de7b1f5104d05455481249c7d95e6540ab59f6bc Mon Sep 17 00:00:00 2001 From: Peter Mosmans Date: Wed, 29 Nov 2017 19:19:57 +1000 Subject: [PATCH] Enforce UTF-8 encoding for XML files --- chatops/python/gitlab-to-pentext.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/chatops/python/gitlab-to-pentext.py b/chatops/python/gitlab-to-pentext.py index 13a4c30..27c14dd 100644 --- a/chatops/python/gitlab-to-pentext.py +++ b/chatops/python/gitlab-to-pentext.py @@ -75,7 +75,7 @@ class BaseItem(object): def write_file(self): """Serialize item to file as XML.""" try: - with io.open(self.filename, 'w') as xmlfile: + with io.open(self.filename, 'w', encoding='utf-8') as xmlfile: xmlfile.write(unicode(self)) print_line('[+] Wrote {0}'.format(self.filename)) except IOError: @@ -121,9 +121,7 @@ class NonFinding(BaseItem): def from_issue(issue): - """ - Parse gitlab issue and return Finding, NonFinding or None - """ + """Parse gitlab issue and return Finding, NonFinding or None.""" if 'finding' in [x.lower() for x in issue.labels]: item = Finding() item.description = convert_text(issue.description) @@ -181,9 +179,7 @@ def ask_permission(question): def list_issues(gitserver, options): - """ - Lists all issues for options['issues'] - """ + """List all issues for options['issues']""" try: for issue in gitserver.project_issues.list(project_id=options['issues'], per_page=999):