feat: 将干扰CSV输出改为GBK
This commit is contained in:
@@ -82,6 +82,7 @@ LTE_PLMN = "460-00"
|
||||
DATABASE_NAME = "interference_etl"
|
||||
DATABASE_TABLE = "interference_hourly_summary"
|
||||
DEFAULT_HISTORY_ROOT = f"{DEFAULT_ROOT}/干扰历史数据"
|
||||
CSV_ENCODING = "gbk"
|
||||
|
||||
HEADER_FDD = (
|
||||
"开始时间",
|
||||
@@ -1082,7 +1083,7 @@ def sql_decimal_literal(value: str, field: str, nullable: bool = False) -> str:
|
||||
|
||||
|
||||
def write_csv(path: Path, header: tuple[str, ...], rows: list[tuple[object, ...]]) -> None:
|
||||
with path.open("w", encoding="utf-8-sig", newline="") as file:
|
||||
with path.open("w", encoding=CSV_ENCODING, newline="") as file:
|
||||
writer = csv.writer(file)
|
||||
writer.writerow(header)
|
||||
for row in rows:
|
||||
@@ -1098,7 +1099,7 @@ def dict_csv_bytes(header: tuple[str, ...], rows: list[dict[str, str]]) -> bytes
|
||||
writer = csv.DictWriter(output, fieldnames=header, extrasaction="raise")
|
||||
writer.writeheader()
|
||||
writer.writerows(rows)
|
||||
return output.getvalue().encode("utf-8-sig")
|
||||
return output.getvalue().encode(CSV_ENCODING)
|
||||
|
||||
|
||||
def ensure_scoped(root: Path, target: Path) -> None:
|
||||
|
||||
Reference in New Issue
Block a user