fix(scripts): write meta_data.json with explicit utf-8 encoding#1047
fix(scripts): write meta_data.json with explicit utf-8 encoding#1047luoxiu065-zjx wants to merge 1 commit into
Conversation
On Windows with a non-UTF-8 locale (e.g. CP936/GBK), the default open() encoding crashes json.dump(..., ensure_ascii=False) whenever metadata contains characters outside the locale's range (e.g. Thai U+0E42 in regional service descriptions), breaking `make build`. The matching read at line 77 already pins utf-8; align the write side. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe ChangesEncoding specification
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
On Windows with a non-UTF-8 locale (e.g. CP936/GBK),
scripts/fetch_meta.pycrashes atjson.dump(..., ensure_ascii=False)whenever the API metadata contains characters outside the locale's range (e.g. ThaiU+0E42from regional service descriptions). This breaksmake buildon every fresh checkout for affected users.Changes
open(OUT_PATH, "w")toencoding="utf-8"so the write side matches the existing utf-8 read at line 77.Test Plan
UnicodeEncodeError: 'gbk' codec can't encode character 'โ'on Windows zh-CN before the fix.python3 scripts/fetch_meta.pywrites a complete `internal/registry/meta_data.json` (~1.4 MB, 13 services) and exits 0 under the same locale.Related Issues
Summary by CodeRabbit