aws / aws-lambda-builders

Python library to compile, build & package AWS Lambda functions for several runtimes & framework
Apache License 2.0
334 stars 139 forks source link

feat: Use errors=replace instead of returning an empty string #556

Closed mildaniel closed 11 months ago

mildaniel commented 11 months ago

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 set error=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.