use 'replace' strategy for invalid encodings

This commit is contained in:
Michael Calmer 2017-11-29 16:57:31 +01:00
parent 89e0781be7
commit 9b67ec0d3d

View File

@ -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: