chore: 导入旧记忆备份供恢复

This commit is contained in:
2026-09-23 22:38:40 +08:00
parent 5313fcee7a
commit 6a6a895eaf
638 changed files with 29816 additions and 1 deletions
@@ -0,0 +1,20 @@
---
title: CSV 编码自动识别不能只靠 GBK 解码报错
type: experience
permalink: main/projects/8e229c96-a83b-4a02-ac40-10a0a9da444e/csv-编码自动识别不能只靠-gbk-解码报错
stable_id: ffa069f7-a3c2-4acc-a4ec-fef9b5f87c80
scope: project
memory_type: experience
project_id: 8e229c96-a83b-4a02-ac40-10a0a9da444e
usage_profile_id: 7aee455b-24cc-4008-bdaf-443721e6f939
status: active
revision: 1
request_id: exp-csv-encoding-autodetect
created_at: '2026-09-17T01:38:38.591136+00:00'
updated_at: '2026-09-17T01:38:38.591136+00:00'
tags:
- encoding
- buildings
---
GetNRBuildingsData.detect_encoding(path, preferred):读 1MB 样本,按最后换行截断;有 BOM 或含非 ASCII 且能严格 UTF-8 解码 → utf-8-sig,否则 gbk;纯 ASCII 用首选;再验表头 WKT/building_id,不行就试其余候选,都不行才报错。原因:GBK 对 UTF-8 字节很宽容,不能靠解码报错判断。validation 把判定结果写回 params[INPUT_ENCODING] 供 worker 使用。当前 source/NRBuildPolygon.csv 实际为纯 ASCII(无 BOM),gbk/utf-8 等价。