summaryrefslogtreecommitdiff
path: root/fail2ban/helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'fail2ban/helpers.py')
-rw-r--r--fail2ban/helpers.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/fail2ban/helpers.py b/fail2ban/helpers.py
index 5c1750a6..de8a2794 100644
--- a/fail2ban/helpers.py
+++ b/fail2ban/helpers.py
@@ -98,6 +98,8 @@ if sys.version_info >= (3,): # pragma: 2.x no cover
if not isinstance(x, bytes):
return str(x)
return x.decode(PREFER_ENC, 'replace')
+ def uni_bytes(x):
+ return bytes(x, 'UTF-8')
else: # pragma: 3.x no cover
def uni_decode(x, enc=PREFER_ENC, errors='strict'):
try:
@@ -115,6 +117,7 @@ else: # pragma: 3.x no cover
return x.encode(PREFER_ENC, 'replace')
else:
uni_string = str
+ uni_bytes = bytes
def _as_bool(val):