Commit 0cb4c81
fix(skills): enforce utf-8 encoding when materializing skill files on Windows
Merge #5820
### Link to Issue or Description of Change
**1. Link to an existing issue (if applicable):**
- Closes: #5819
- Related: #5819
**2. Or, if no issue exists, describe the change:**
**Problem:**
When running the ADK on Windows, executing a skill script via `_SkillScriptCodeExecutor` fails with a `UnicodeEncodeError` if 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'` when `mode == '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.
Co-authored-by: Xuan Yang <xygoogle@google.com>
COPYBARA_INTEGRATE_REVIEW=#5820 from mc-marcocheng:fix/skill-toolset-utf8 eecabb6
PiperOrigin-RevId: 9338440651 parent 81b8067 commit 0cb4c81
2 files changed
Lines changed: 58 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
669 | 669 | | |
670 | 670 | | |
671 | 671 | | |
672 | | - | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
673 | 676 | | |
674 | 677 | | |
675 | 678 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
817 | 817 | | |
818 | 818 | | |
819 | 819 | | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
820 | 845 | | |
821 | 846 | | |
822 | 847 | | |
| |||
1251 | 1276 | | |
1252 | 1277 | | |
1253 | 1278 | | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
1254 | 1308 | | |
1255 | 1309 | | |
1256 | 1310 | | |
| |||
0 commit comments