Description of changes:
A previous change handled decoding errors by catching a UnicodeDecodeError and returning an empty string. Instead, a more graceful approach is to set error=replace which will replace any unrecognized characters with a replacement characters instead of throwing an exception.
Issue #, if available: https://github.com/aws/aws-sam-cli/issues/6075
Description of changes: A previous change handled decoding errors by catching a
UnicodeDecodeError
and returning an empty string. Instead, a more graceful approach is to seterror=replace
which will replace any unrecognized characters with a replacement characters instead of throwing an exception.https://docs.python.org/3/library/codecs.html#codec-base-classes
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.