diff --git a/core/input/input_builders.py b/core/input/input_builders.py index eabdefe5436..ae848f4e7cd 100644 --- a/core/input/input_builders.py +++ b/core/input/input_builders.py @@ -13,7 +13,7 @@ def make_default_controller_mappings(target, source, env): # ensure mappings have a consistent order platform_mappings: dict = OrderedDict() for src_path in source: - with open(str(src_path), "r") as f: + with open(str(src_path), "r", encoding="utf-8") as f: # read mapping file and skip header mapping_file_lines = f.readlines()[2:] diff --git a/gles3_builders.py b/gles3_builders.py index 985e9d547ce..cf7c74f32d8 100644 --- a/gles3_builders.py +++ b/gles3_builders.py @@ -31,7 +31,7 @@ class GLES3HeaderStruct: def include_file_in_gles3_header(filename: str, header_data: GLES3HeaderStruct, depth: int): - with open(filename, "r") as fs: + with open(filename, "r", encoding="utf-8") as fs: line = fs.readline() while line: diff --git a/glsl_builders.py b/glsl_builders.py index fd90e9a6c0a..5a17e3ca7f9 100644 --- a/glsl_builders.py +++ b/glsl_builders.py @@ -38,7 +38,7 @@ class RDHeaderStruct: def include_file_in_rd_header(filename: str, header_data: RDHeaderStruct, depth: int) -> RDHeaderStruct: - with open(filename, "r") as fs: + with open(filename, "r", encoding="utf-8") as fs: line = fs.readline() while line: @@ -172,7 +172,7 @@ class RAWHeaderStruct: def include_file_in_raw_header(filename: str, header_data: RAWHeaderStruct, depth: int) -> None: - with open(filename, "r") as fs: + with open(filename, "r", encoding="utf-8") as fs: line = fs.readline() while line: diff --git a/methods.py b/methods.py index 5aa34888eb0..c0d129f93ed 100644 --- a/methods.py +++ b/methods.py @@ -179,7 +179,7 @@ def get_version_info(module_version_string="", silent=False): gitfolder = ".git" if os.path.isfile(".git"): - with open(".git", "r") as file: + with open(".git", "r", encoding="utf-8") as file: module_folder = file.readline().strip() if module_folder.startswith("gitdir: "): gitfolder = module_folder[8:] @@ -196,12 +196,12 @@ def get_version_info(module_version_string="", silent=False): head = os.path.join(gitfolder, ref) packedrefs = os.path.join(gitfolder, "packed-refs") if os.path.isfile(head): - with open(head, "r") as file: + with open(head, "r", encoding="utf-8") as file: githash = file.readline().strip() elif os.path.isfile(packedrefs): # Git may pack refs into a single file. This code searches .git/packed-refs file for the current ref's hash. # https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git-pack-refs.html - for line in open(packedrefs, "r").read().splitlines(): + for line in open(packedrefs, "r", encoding="utf-8").read().splitlines(): if line.startswith("#"): continue (line_hash, line_ref) = line.split(" ") @@ -270,7 +270,7 @@ const uint64_t VERSION_TIMESTAMP = {git_timestamp}; def parse_cg_file(fname, uniforms, sizes, conditionals): - with open(fname, "r") as fs: + with open(fname, "r", encoding="utf-8") as fs: line = fs.readline() while line: @@ -1243,7 +1243,7 @@ def generate_vs_project(env, original_args, project_name="godot"): ).hexdigest() if os.path.exists(f"{project_name}.vcxproj.filters"): - with open(f"{project_name}.vcxproj.filters", "r") as file: + with open(f"{project_name}.vcxproj.filters", "r", encoding="utf-8") as file: existing_filters = file.read() match = re.search(r"(?ms)^