From 9b67ec0d3d433eed5ed124a0f50c1f90d357acbc Mon Sep 17 00:00:00 2001 From: Michael Calmer Date: Wed, 29 Nov 2017 16:57:31 +0100 Subject: [PATCH] use 'replace' strategy for invalid encodings --- salt/modules/cmdmod.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/salt/modules/cmdmod.py b/salt/modules/cmdmod.py index f45ae6e84d..2275204c83 100644 --- a/salt/modules/cmdmod.py +++ b/salt/modules/cmdmod.py @@ -591,7 +591,7 @@ def _run(cmd, out = u'' except UnicodeDecodeError: log.error("UnicodeDecodeError while decoding output of cmd {0}".format(cmd)) - out = proc.stdout.decode(__salt_system_encoding__, 'ignore') + out = proc.stdout.decode(__salt_system_encoding__, 'replace') try: err = proc.stderr.decode(__salt_system_encoding__) @@ -599,7 +599,7 @@ def _run(cmd, err = u'' except UnicodeDecodeError: log.error("UnicodeDecodeError while decoding error of cmd {0}".format(cmd)) - err = proc.stderr.decode(__salt_system_encoding__, 'ignore') + err = proc.stderr.decode(__salt_system_encoding__, 'replace') if rstrip: