Digests of parsed JSON with ensure_ascii=False raise UnicodeEncodeError for a lone-surrogate escape in the input
Maintainer thường phản hồi trong vòng 1 ngày
@antonwolfy đang làm issue này rồi.
Từ ngày 13/11/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Several digests dump parsed data with ensure_ascii=False and encode with .encode("utf-8"): item_digest and assignment_digest (dokimi/dokimi/eval/leakgate.py:162,175), graph_digest (dokimi/dokimi/eval_coverage.py:71), expectations_digest (dokimi/dokimi/repos/conformance.py:108), response_cache_key (dokimi/dokimi/caching.py:377) and _content_key (dokimi/dokimi/harnesses/harbor_export.py:100, resolved.encode()). A JSON or YAML escape such as "\udcff" in the input file loads as a lone surrogate and the encode raises. Plain file text is not a trigger: it is decoded as strict UTF-8.
Repro, each with json.loads('"n\\udcff"') as the value:
leakgate.item_digest({"grading": {"expected": S}}) -> UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 14: surrogates not allowed
eval_coverage.graph_digest({"nodes": [{"id": "a", "text": S, "path_class": "x"}]}) -> ... position 65
conformance.expectations_digest({"a": S}) -> ... position 7
caching.response_cache_key(litellm_model="m", messages=[{"role": "user", "content": S}]) -> ... position 41
harbor_export._content_key(path, "n\udcff") -> ... position 1
Fix options: .encode("utf-8", "surrogatepass") keeps every digest that encodes today unchanged and separates different surrogates; or refuse a lone surrogate in the loader with a message. Not errors="replace", which makes two inputs collide. Whether _content_key is reached depends on _task_toml writing a raw surrogate, which was not traced.
Found while fixing #675. The fix's PR is #721.
- Ngôn ngữ chính
- Python
- Star
- 15
- Fork
- 11
- Merge trung bình
- 1 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 464
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của intel/dokimi
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
OCA/account-invoicing#2529 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/ci
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ImageGen generate-batch aborts valid JSONL jobs containing a Unicode line separator in poster textĐang mởbug imagen skills
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Email validation accepts a trailing newlineCó thể đã có người làm @marcello-pichini đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày