fix(feishu): correct Chinese filename encoding in attachments#1834
Open
BingqingLyu wants to merge 1 commit into
Open
fix(feishu): correct Chinese filename encoding in attachments#1834BingqingLyu wants to merge 1 commit into
BingqingLyu wants to merge 1 commit into
Conversation
Fixes openclaw#59409 When receiving files with Chinese filenames via Feishu webhook, the filenames were displayed as garbled text (Latin-1 decoded UTF-8 bytes). Root cause: - HTTP headers are typically parsed as ISO-8859-1 (Latin-1) - UTF-8 encoded filenames get misinterpreted as Latin-1 characters - Example: "六大组件全解析.md" shows as "å_å_ç_ä_å_è_æ.md" Solution: - Added fixMisdecodedUtf8() function to detect and correct the encoding - Re-encodes Latin-1 chars back to bytes and decodes as UTF-8 - Applied to both Content-Disposition header and API response file_name The fix preserves valid Latin-1 strings and only corrects misdecoded UTF-8.
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.
Fixes openclaw#59409
Summary
When receiving files with Chinese filenames via Feishu webhook, the filenames were displayed as garbled text (Latin-1 decoded UTF-8 bytes).
Root Cause
六大组件全解析.mdshows aså_å_ç_ä_å_è_æ.mdSolution
fixMisdecodedUtf8()function to detect and correct the encodingfile_namefieldTest Plan
~/.openclaw/media/inbound/六大组件全解析---<uuid>.md)🤖 Generated with ClawHub