1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Avoid UnicodeDecodeError exception when passing module args

This commit is contained in:
Wanderlei Antonio Cavassin 2013-12-06 12:59:43 -02:00
parent 10f5af82f9
commit 6ba93817a9

View file

@ -136,7 +136,10 @@ class ModuleReplacer(object):
complex_args_json = utils.jsonify(complex_args) complex_args_json = utils.jsonify(complex_args)
# We force conversion of module_args to str because module_common calls shlex.split, # We force conversion of module_args to str because module_common calls shlex.split,
# a standard library function that incorrectly handles Unicode input before Python 2.7.3. # a standard library function that incorrectly handles Unicode input before Python 2.7.3.
try:
encoded_args = repr(module_args.encode('utf-8')) encoded_args = repr(module_args.encode('utf-8'))
except UnicodeDecodeError:
encoded_args = repr(module_args)
encoded_lang = repr(C.DEFAULT_MODULE_LANG) encoded_lang = repr(C.DEFAULT_MODULE_LANG)
encoded_complex = repr(complex_args_json) encoded_complex = repr(complex_args_json)