🔴 Required Information
Describe the Bug:
When a tool saves a text artifact containing non-ASCII characters using
Part.from_text(), the preview in the Artifacts tab and inline chat bubble
renders garbled characters instead of the original text.
Steps to Reproduce:
Please provide a numbered list of steps to reproduce the behavior:
- Create an agent with a tool that saves a text artifact:
async def save_text_file(filename: str, tool_context: ToolContext) -> str:
part = types.Part.from_text(text="こんにちは")
await tool_context.save_artifact("hello.txt", part)
return "Saved"
- Run adk web and ask the agent to call the tool
- Open the Artifacts tab in the right panel
- Observe the text preview
Expected Behavior:
Observed Behavior:
UTF-8 bytes are misinterpreted as Latin-1 (ISO-8859-1).
Environment Details:
- ADK Library Version: 2.1.0
- Desktop OS: Windows
- Python Version: 3.12.10
Model Information:
- Are you using LiteLLM: No
- Which model is being used: gemini-2.5-flash
🟡 Optional Information
Regression:
N/A
Logs:
N/A
Screenshots / Video:
Before (garbled):

After applying fix (decodeURIComponent(escape(atob(base64))))

Additional Context:
Root Cause:
renderArtifact() encodes text as btoa(unescape(encodeURIComponent(text))),
but getTextContent() only calls atob(base64) without the reverse step.
Fix (2 occurrences in artifact-tab.component.ts):
Before:
After:
return decodeURIComponent(escape(atob(base64)));
Minimal Reproduction Code:
async def save_text_file(filename: str, tool_context: ToolContext) -> str:
part = types.Part.from_text(text="こんにちは")
await tool_context.save_artifact("hello.txt", part)
return "Saved"
How often has this issue occurred?:
🔴 Required Information
Describe the Bug:
When a tool saves a text artifact containing non-ASCII characters using
Part.from_text(), the preview in the Artifacts tab and inline chat bubblerenders garbled characters instead of the original text.
Steps to Reproduce:
Please provide a numbered list of steps to reproduce the behavior:
Expected Behavior:
Observed Behavior:
UTF-8 bytes are misinterpreted as Latin-1 (ISO-8859-1).
Environment Details:
Model Information:
🟡 Optional Information
Regression:
N/A
Logs:
N/A
Screenshots / Video:


Before (garbled):
After applying fix (
decodeURIComponent(escape(atob(base64))))Additional Context:
Root Cause:
renderArtifact()encodes text asbtoa(unescape(encodeURIComponent(text))),but
getTextContent()only callsatob(base64)without the reverse step.Fix (2 occurrences in
artifact-tab.component.ts):Before:
After:
Minimal Reproduction Code:
How often has this issue occurred?: