fix compile errors on exotic windows codepages (#19508)

This commit is contained in:
blakadder 2023-09-13 15:06:01 +02:00 committed by GitHub
parent 6d0b2f6bc3
commit 8246410c8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View File

@ -159,7 +159,7 @@ class block_builder:
def writefile(self, filename, text):
otext = "#include \"be_constobj.h\"\n\n" + text
with open(filename, "w") as f:
with open(filename, "w", encoding='utf-8') as f:
f.write(otext)
def dumpfile(self, path):

View File

@ -34,7 +34,7 @@ class builder:
if re.search(r"\.(h|c|cc|cpp)$", filename):
# print(f"> parse {filename}")
text = ""
with open(filename) as f:
with open(filename, encoding='utf-8') as f:
text = f.read()
# print(f"> len(text)={len(text)}")
parser = coc_parser(text)

View File

@ -22,7 +22,7 @@ class macro_table:
def scan_file(self, filename):
str = ""
with open(filename) as f:
with open(filename, encoding='utf-8') as f:
str = f.read()
r = macro_table.pat.findall(str)
for it in r:

View File

@ -86,7 +86,7 @@ headers_names += list_files("../../LVGL_assets/src/", ["lv_theme_haspmota.h"])
# headers_names = [ '../../lib/libesp32_lvgl/LVGL/src/lv_api_map.h' ]
output_filename = "../mapping/lv_funcs.h"
sys.stdout = open(output_filename, 'w')
sys.stdout = open(output_filename, 'w', encoding='utf-8')
print("""
// Automatically generated from LVGL source with `python3 preprocessor.py`
@ -121,7 +121,7 @@ lv_coord_t lv_get_ver_res(void);
""")
for header_name in headers_names:
with open(header_name) as f:
with open(header_name, encoding='utf-8') as f:
print("// " + header_name)
raw = clean_source(f.read())
@ -198,7 +198,7 @@ lv_fun_globs = [
headers_names = list_files(lv_src_prefix, lv_fun_globs)
output_filename = "../mapping/lv_enum.h"
sys.stdout = open(output_filename, 'w')
sys.stdout = open(output_filename, 'w', encoding='utf-8')
print("""// ======================================================================
// Functions
// ======================================================================

View File

@ -10,7 +10,7 @@ def firm_metrics(source, target, env):
env.Execute("$PYTHONEXE -m tasmota_metrics \"" + str(tasmotapiolib.get_source_map_path(env).resolve()) + "\"")
elif env["PIOPLATFORM"] == "espressif8266":
map_file = join(env.subst("$BUILD_DIR")) + os.sep + "firmware.map"
with open(map_file,'r') as f:
with open(map_file,'r', encoding='utf-8') as f:
phrase = "_text_end = ABSOLUTE (.)"
for line in f:
if phrase in line: