From 2553a65425651b43d739ba4a3b5fd196d1d3d06d Mon Sep 17 00:00:00 2001 From: Johnni Winther Date: Tue, 5 Mar 2024 14:25:09 +0000 Subject: [PATCH] [presubmit] Force read files as UTF-8 The avoids the Windows default of using ANSI. Change-Id: I1a6177729bb4e2453522e763b490396b2f930a42 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355741 Reviewed-by: Jonas Termansen Commit-Queue: Johnni Winther --- PRESUBMIT.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 997f6d349c9..d009e8dcca3 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -129,7 +129,7 @@ def _CheckDartFormat(input_api, output_api): # them. def skip_file(path): if path.endswith('_test.dart'): - with open(path) as f: + with open(path, encoding='utf-8') as f: contents = f.read() if '//#' in contents: return True @@ -427,7 +427,7 @@ def _CheckCopyrightYear(input_api, output_api): path = f.LocalPath() if (is_dart_file(path) or is_cpp_file(path) ) and f.Action() == 'A' and os.path.isfile(path): - with open(path) as f: + with open(path, encoding='utf-8') as f: first_line = f.readline() if 'Copyright' in first_line and year not in first_line: files.append(path)