diff options
author | William Deegan <bill@baddogconsulting.com> | 2017-08-23 15:21:14 -0700 |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2017-08-23 15:21:14 -0700 |
commit | aff283ac751aeecdb6cd7d5ee0153ad874e550a5 (patch) | |
tree | 287025f92b7b2aa2cbf1efd0039e9d795c1b58d1 | |
parent | 6fb2633243c7351ad53d2558e7388868c359e900 (diff) | |
download | scons-aff283ac751aeecdb6cd7d5ee0153ad874e550a5.tar.gz |
Handle decode errors by backslashing character. Should only throw exception if content is not a byte type now
-rw-r--r-- | src/engine/SCons/Node/FS.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 638819a7..606ecfda 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -2654,9 +2654,9 @@ class File(Base): if contents[:len(codecs.BOM_UTF16_BE)] == codecs.BOM_UTF16_BE: return contents[len(codecs.BOM_UTF16_BE):].decode('utf-16-be') try: - return contents.decode() + return contents.decode('utf-8',errors='backslashreplace') except (UnicodeDecodeError, AttributeError) as e: - return contents.decode('utf-8') + return contents def get_content_hash(self): |