fix: одинарное экранирование BOM и нулевого пробела в экспорте CSV

This commit is contained in:
GGlamer 2026-09-27 22:54:00 +03:00
commit 2b4516a6a8

View file

@ -19,7 +19,7 @@ def _cell(value: object) -> str:
if value is None:
return ""
result = str(value)
probe = result.lstrip(" \t\r\n\\ufeff\\u200b")
probe = result.lstrip(" \t\r\n​")
if probe.startswith(("=", "+", "-", "@")) or result.startswith(("\t", "\r", "\n")):
return "'" + result
return result
@ -96,7 +96,7 @@ def to_csv(report: SessionReport) -> bytes:
row("Сверка самооценки", "", label, ", ".join(values))
for number, item in enumerate(report.notes, 1):
row("Пометки преподавателя", number, item.transcript_ref, item.text, item.author)
return ("\\ufeff" + output.getvalue()).encode("utf-8")
return ("" + output.getvalue()).encode("utf-8")
def _font_paths() -> tuple[Path, Path | None]: