mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-07 17:08:49 +00:00
feat(tools): Enforce utf-8 encoding with open() function
This commit is contained in:
@@ -676,7 +676,7 @@ def main():
|
||||
|
||||
if input_is_binary:
|
||||
output = table.to_csv()
|
||||
with sys.stdout if args.output == '-' else open(args.output, 'w') as f:
|
||||
with sys.stdout if args.output == '-' else open(args.output, 'w', encoding='utf-8') as f:
|
||||
f.write(output)
|
||||
else:
|
||||
output = table.to_binary()
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
#!/usr/bin/env python
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import argparse
|
||||
|
||||
|
||||
def gen_header_file(path: str, subtypes: str) -> None:
|
||||
HDR_MESSAGE = '/* Automatically generated file. DO NOT EDIT. */\n\n'
|
||||
PARTTOOL_USAGE = 'If you want to use parttool.py manually, please use the following as an extra argument:'
|
||||
with open(path, 'w') as f:
|
||||
with open(path, 'w', encoding='utf-8') as f:
|
||||
f.write(HDR_MESSAGE)
|
||||
if subtypes:
|
||||
f.write('/*\n\t' + PARTTOOL_USAGE + '\n\t')
|
||||
|
||||
@@ -92,7 +92,7 @@ class ParttoolTarget():
|
||||
partition_table = gen.PartitionTable.from_binary(f.read())
|
||||
|
||||
if partition_table is None:
|
||||
with open(partition_table_file, 'r') as f:
|
||||
with open(partition_table_file, 'r', encoding='utf-8') as f:
|
||||
f.seek(0)
|
||||
partition_table = gen.PartitionTable.from_csv(f.read())
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user