Commit 2b99d430 authored by chrisha@chromium.org's avatar chrisha@chromium.org

Handle non-UTF-8 encoded files in presubmit checks.


BUG=
TEST=


Review URL: https://chromiumcodereview.appspot.com/10696202

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@146391 0039d316-1c4b-4281-b951-d872f2087c98
parent c3cd5378
......@@ -80,7 +80,11 @@ def FileRead(filename, mode='rU'):
with open(filename, mode=mode) as f:
# codecs.open() has different behavior than open() on python 2.6 so use
# open() and decode manually.
return f.read().decode('utf-8')
s = f.read()
try:
return s.decode('utf-8')
except UnicodeDecodeError:
return s
def FileWrite(filename, content, mode='w'):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment