fix(client): decode UTF-8 HTML resource blobs - #222
Open
lllleolin-max wants to merge 1 commit into
Open
lllleolin-max wants to merge 1 commit into
lllleolin-max wants to merge 1 commit into
Conversation
Decode Base64 byte strings as UTF-8 for both MCP-client and onReadResource HTML loading. Cover ASCII and multibyte text through both paths. Assisted-by: OpenAI GPT-6 <noreply@openai.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.
HTML resources returned as UTF-8 Base64 blobs currently turn text such as
你好, café 👋into mojibake before it reachesAppFrame.atob()returns a byte string, whereas the server'sutf8ToBase64()encodes UTF-8 bytes.Decode those bytes with
TextDecoderin bothreadToolUiResourceHtml()and theonReadResourcecallback path. Add regression tests for ASCII and 2-, 3-, and 4-byte characters, including an assertion on the HTML actually passed toAppFrame.Validation:
pnpm buildpasses for all three SDKs, including declarations;pnpm lintpasses.Existing build warnings concern the empty shared package and unnamed UMD externals. The two server examples still fail on untouched API imports/options; Ruby tests were not run because Ruby/Bundler are unavailable. The older
remote-dom-demoandwc-demodirectories listed in the development guide are absent.AI assistance: OpenAI Codex investigated, implemented, tested, and reviewed this change. No independent human review is claimed.