fix: add UTF-8 encoding validation before Feishu document import#86
Open
Luoqiu1 wants to merge 1 commit intoriba2534:mainfrom
Open
fix: add UTF-8 encoding validation before Feishu document import#86Luoqiu1 wants to merge 1 commit intoriba2534:mainfrom
Luoqiu1 wants to merge 1 commit intoriba2534:mainfrom
Conversation
Add a defensive encoding check to feishu-cli-import and feishu-cli-write skills. The check detects both U+FFFD replacement characters and invalid UTF-8 byte sequences in Markdown files before importing to Feishu, preventing corrupted characters from flowing into documents. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
feishu-cli-import和feishu-cli-write技能的导入前流程中新增 UTF-8 编码防御性检查�)Background
实际使用中遇到过大 Markdown 文件中部分中文字符出现 UTF-8 多字节截断的情况,损坏的字符被直接导入到飞书文档中显示为乱码。由于
feishu-cli doc import本身不做编码校验,需要在技能层增加前置检查作为防御性兜底。Changes
skills/feishu-cli-import/SKILL.md:在"验证文件"步骤中新增编码验证skills/feishu-cli-write/SKILL.md:在"生成 Markdown"步骤后新增编码验证验证命令:
python3 -c "d=open('<file.md>','rb').read(); assert b'\xef\xbf\xbd' not in d, 'U+FFFD found'; d.decode('utf-8')"Test results
三项测试全部通过:
Test 1: 包含 U+FFFD 替换字符的文件 ✅
Test 2: 包含截断 UTF-8 字节的文件 ✅
Test 3: 正常 UTF-8 文件 ✅
🤖 Generated with Claude Code