Handle decode errors by backslashing character. Should only throw exception if conten...
authorWilliam Deegan <bill@baddogconsulting.com>
Wed, 23 Aug 2017 22:21:14 +0000 (15:21 -0700)
committerWilliam Deegan <bill@baddogconsulting.com>
Wed, 23 Aug 2017 22:21:14 +0000 (15:21 -0700)
src/engine/SCons/Node/FS.py

index 638819a74bffd4de20d85a364028529f162d1751..606ecfda38e8be328536f9ccc9a2dc9ada746126 100644 (file)
@@ -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):