fix(skill_toolset): enforce utf-8 encoding when materializing skill files on Windows#5820
fix(skill_toolset): enforce utf-8 encoding when materializing skill files on Windows#5820mc-marcocheng wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Response from ADK Triaging Agent Hello @mc-marcocheng, thank you for creating this PR! It looks like the Google Contributor License Agreement (CLA) check has failed for this pull request. Could you please complete the following action from our contribution guidelines?
You can visit https://cla.developers.google.com/ to see your current agreements or to sign a new one. This is required so that we can review and merge your contribution. Thanks! |
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
2. Or, if no issue exists, describe the change:
Problem:
When running the ADK on Windows, executing a skill script via
_SkillScriptCodeExecutorfails with aUnicodeEncodeErrorif the skill's resources (references, assets, or scripts) contain non-ASCII characters. The generated wrapper script writes these files without specifying an encoding, causing Windows to fall back to its system locale encoding (e.g.,cp1252).Solution:
By explicitly setting
encoding='utf-8'whenmode == 'w'in the generated wrapper script, we ensure that text files are correctly written regardless of the system's default locale encoding. Binary assets (mode == 'wb') continue to be handled properly without an encoding argument.Testing Plan
Unit Tests:
Summary of passed
pytestresults:Manual End-to-End (E2E) Tests:
_build_wrapper_codewith Chinese characters (你好,世界) and executed the generated script.UnicodeEncodeErrorduring manual execution.test_integration_python_unicode_materialization) that acts as an automated E2E test by using the realUnsafeLocalCodeExecutorto materialize and run a script reading the Unicode content.Checklist
Additional context
N/A