From: William Deegan Date: Wed, 23 Aug 2017 22:21:14 +0000 (-0700) Subject: Handle decode errors by backslashing character. Should only throw exception if conten... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=38acad8afd2f64dd6e126e359f9d25be177aff2a;p=platform%2Fupstream%2Fscons.git Handle decode errors by backslashing character. Should only throw exception if content is not a byte type now --- 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):