diff --git a/detect_secrets/plugins/common/ini_file_parser.py b/detect_secrets/plugins/common/ini_file_parser.py index c7918f3fe..e4b433cff 100644 --- a/detect_secrets/plugins/common/ini_file_parser.py +++ b/detect_secrets/plugins/common/ini_file_parser.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + import configparser import re @@ -20,7 +22,8 @@ def __init__(self, file, add_header=False, exclude_lines_regex=None): try: # python2.7 compatible self.parser.optionxform = unicode - except NameError: + except NameError: # pragma: no cover + # python3 compatible self.parser.optionxform = str self.exclude_lines_regex = exclude_lines_regex @@ -34,7 +37,7 @@ def __init__(self, file, add_header=False, exclude_lines_regex=None): try: # python2.7 compatible self.parser.read_string(unicode(content)) - except NameError: + except NameError: # pragma: no cover # python3 compatible self.parser.read_string(content) diff --git a/test_data/config.ini b/test_data/config.ini index 97f5e14b4..cd2dc9f23 100644 --- a/test_data/config.ini +++ b/test_data/config.ini @@ -24,3 +24,6 @@ keyB = 456789123 keyC = password = 12345678901234 # pragma: whitelist secret + +# unicode +foo=bår