Skip to content

Write generate-cli output as UTF-8 - #5335

Merged
jlowin merged 2 commits into
PrefectHQ:mainfrom
asasemahmed:fix/generate-cli-utf8-output
Oct 5, 2026
Merged

jlowin merged 2 commits into
PrefectHQ:mainfrom
asasemahmed:fix/generate-cli-utf8-output

Conversation

@asasemahmed

@asasemahmed asasemahmed commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

generate-cli wrote the generated script and SKILL.md with Path.write_text() and no encoding, so on Windows they were encoded with the system code page. A tool description containing a character outside that code page made generation fail. Characters that do exist in it produced a script Python rejects, since source files must be UTF-8. Both files are now written as UTF-8, matching how downloaded skills are written since #4715.

@mcp.tool
def forecast(city: str) -> str:
    """Forecast for a city — temperature in °C → rounded."""

# before (cp1252): UnicodeEncodeError: 'charmap' codec can't encode character '→'
# after:           weather_cli.py and SKILL.md written as UTF-8

Fixes #5320

The generated artifact readers in the tests also use UTF-8, carrying forward the corrections from #5357 by @ch-z-hc.

Fixes #5354

Co-authored-by: ch-z-hc 45302000+ch-z-hc@users.noreply.github.com

@github-actions

Copy link
Copy Markdown
Contributor

This pull request is awaiting maintainer assignment. Linked PRs stay open while maintainers triage the issue; this check remains failing until assignment.

Per CONTRIBUTING.md, an external PR must reference an issue that's assigned to its author. To get there:

  1. A maintainer will review the issue and decide whether to assign you. Please don't comment just to request assignment.

Once you're assigned and the link is present, this check is re-run automatically. Previously gate-closed PRs also reopen — no further action needed.

Maintainers: reopen this PR or remove the missing-issue-link label to bypass this check.

@marvin-context-protocol marvin-context-protocol Bot added bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. cli Related to FastMCP CLI commands (run, dev, install) or CLI functionality. labels Sep 28, 2026
@asasemahmed
asasemahmed force-pushed the fix/generate-cli-utf8-output branch from 9d11e5c to 3be5f55 Compare September 30, 2026 23:37
Co-authored-by: ch-z-hc <45302000+ch-z-hc@users.noreply.github.com>

@jlowin jlowin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UTF-8 output fix and locale-sensitive test readers are verified. Current code CI and downstream smoke pass.

@jlowin
jlowin merged commit dd3c278 into PrefectHQ:main Oct 5, 2026
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. cli Related to FastMCP CLI commands (run, dev, install) or CLI functionality. missing-issue-link

Projects

None yet

2 participants