# Text Encoding and Excel Write-Back Rules
These rules are mandatory for every script, temporary repair, and manual write-back that touches Excel text fields such as customer notes, outreach status, follow-up status, Chinese summaries, or HTML previews.
Windows PowerShell inline scripts can corrupt Chinese text when a command contains Chinese literals inside a here-string, heredoc-like block, or inline Python source. The corrupted text appears in Excel or HTML as repeated question marks. This has already happened in the workbook notes after email status write-back, so future runs must treat encoding as a hard safety rule.
\u90ae\u4ef6\u53d1\u9001\u8bb0\u5f55;encoding="utf-8" or encoding="utf-8-sig" explicitly when reading or writing JSON, Markdown, HTML, CSV, or text artifacts.备注, 建联状态, 下次跟进, 客户属性, 客户类型, and generated HTML preview labels when applicable.Every write-back report should include these counts:
question_mark_cells: number of workbook cells containing repeated question marks after save.question_mark_note_rows: number of note rows containing repeated question marks after save.html_question_mark_groups: number of repeated-question-mark groups in generated HTML previews.If any count is greater than zero, the task is not complete.
For email write-back notes, prefer structured data first:
{
"event": "email_sent",
"sent_at": "2026-07-29 12:40:58",
"template_kind": "auto_channel_partner",
"emails": ["example@company.com"],
"send_log": "runs/YYYYMMDD/<run_id>/send-log.jsonl"
}
Then render the Chinese note inside a UTF-8 Python module or via Unicode escapes. Do not render it inside a PowerShell command containing raw Chinese.
Use these meanings consistently when rendering from safe code:
邮件发送记录:... 已按...模板发送至 ...;发送日志:...。邮件状态修复:发送日志确认已于 ... 向 ... 发送邮件;原状态为 ...。等待回复已发送邮件If repeated question marks appear:
question_mark_cells = 0.