Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compile errors on exotic windows codepages #19508

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/libesp32/berry/tools/coc/block_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def name(self, block):

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):
Expand Down
2 changes: 1 addition & 1 deletion lib/libesp32/berry/tools/coc/coc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/libesp32/berry/tools/coc/macro_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def parse_value(self, s):

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:
Expand Down
6 changes: 3 additions & 3 deletions lib/libesp32_lvgl/lv_binding_berry/tools/preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def clean_source(raw):
# 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`
Expand Down Expand Up @@ -121,7 +121,7 @@ def clean_source(raw):
""")

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())

Expand Down Expand Up @@ -198,7 +198,7 @@ def clean_source(raw):
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
// ======================================================================
Expand Down
2 changes: 1 addition & 1 deletion pio-tools/metrics-firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down