From c13862104ab64cda81c86c51b849c8d01c3c9187 Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Nov 25 2014 13:15:44 +0000 Subject: Fix zonemgr option encoding detection Ticket: https://fedorahosted.org/freeipa/ticket/4766 Reviewed-By: Jan Cholasta --- diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py index f02fe86..547cf19 100644 --- a/ipaserver/install/bindinstance.py +++ b/ipaserver/install/bindinstance.py @@ -405,7 +405,10 @@ def zonemgr_callback(option, opt_str, value, parser): # validate the value first try: # IDNA support requires unicode - value = value.decode(getattr(sys.stdin, 'encoding', 'utf-8')) + encoding = getattr(sys.stdin, 'encoding', None) + if encoding is None: + encoding = 'utf-8' + value = value.decode(encoding) validate_zonemgr_str(value) except ValueError, e: parser.error("invalid zonemgr: " + unicode(e))