diff --git a/core/input/input_builders.py b/core/input/input_builders.py index eabdefe5436b..ae848f4e7cd5 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 985e9d547ce2..cf7c74f32d8a 100644 --- a/gles3_builders.py +++ b/gles3_builders.py @@ -31,7 +31,7 @@ def __init__(self): 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 fd90e9a6c0a8..5a17e3ca7f9d 100644 --- a/glsl_builders.py +++ b/glsl_builders.py @@ -38,7 +38,7 @@ def __init__(self): 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 @@ def __init__(self): 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 5aa34888eb0a..c0d129f93ed6 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 @@ def generate_version_header(module_version_string=""): 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 format_key_value(v): ).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)^