fail2ban-regex open files as utf-8 for python3

This commit is contained in:
Steven Hiscocks 2013-02-24 18:59:07 +00:00
parent dbc40d6210
commit 418d845f9b

View file

@ -346,7 +346,10 @@ if __name__ == "__main__":
if fail2banRegex.logIsFile(cmd_log):
try:
hdlr = open(cmd_log)
if sys.version_info >= (3,):
hdlr = open(cmd_log, encoding='utf-8', errors='ignore')
else:
hdlr = open(cmd_log)
print "Use log file : " + cmd_log
print
for line in hdlr: