From 6d788629a277837191a54a2f900dfdd72b155ce7 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 2 Feb 2015 13:37:31 -0800 Subject: [PATCH] Be explicit about unicode str transformation Fixes #10126 --- lib/ansible/callbacks.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/ansible/callbacks.py b/lib/ansible/callbacks.py index c2d811bb8f..3c0a4fe52e 100644 --- a/lib/ansible/callbacks.py +++ b/lib/ansible/callbacks.py @@ -629,7 +629,13 @@ class PlaybookCallbacks(object): if hasattr(self, 'start_at'): # we still have start_at so skip the task self.skip_task = True elif hasattr(self, 'step') and self.step: - msg = ('Perform task: %s (y/n/c): ' % name).encode(sys.stdout.encoding) + if isinstance(name, str): + name = utils.to_unicode(name) + msg = u'Perform task: %s (y/n/c): ' % name + if sys.stdout.encoding: + msg = msg.encode(sys.stdout.encoding, errors='replace') + else: + msg = msg.encode('utf-8') resp = raw_input(msg) if resp.lower() in ['y','yes']: self.skip_task = False