fix: write UTF-8 characters in apm.yml instead of escaped \xNN sequences#388
fix: write UTF-8 characters in apm.yml instead of escaped \xNN sequences#388alopezsanchez wants to merge 1 commit intomicrosoft:mainfrom
\xNN sequences#388Conversation
|
@alopezsanchez please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
Pull request overview
Fixes Unicode escaping in generated/rewritten apm.yml files by configuring PyYAML to emit real UTF-8 characters instead of \xNN escape sequences, addressing issue #387.
Changes:
- Add
allow_unicode=Trueto multipleyaml.dump/yaml.safe_dumpcall sites that writeapm.yml. - Add a unit test ensuring
apm initwrites non-ASCIIauthorvalues as real UTF-8 characters. - Update GitHub downloader stamping logic to preserve Unicode when rewriting synthesized
apm.yml.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_init_command.py | Adds coverage to verify apm init writes Unicode authors without escape sequences. |
| src/apm_cli/deps/github_downloader.py | Ensures rewritten apm.yml (version stamping) preserves Unicode characters. |
| src/apm_cli/core/script_runner.py | Ensures script-runner updates/minimal config writes preserve Unicode characters. |
| src/apm_cli/commands/uninstall/cli.py | Ensures apm uninstall updates to apm.yml preserve Unicode characters. |
| src/apm_cli/commands/install.py | Ensures apm install updates to apm.yml preserve Unicode characters. |
| src/apm_cli/commands/_helpers.py | Ensures helper-generated minimal apm.yml preserves Unicode characters. |
…ences PyYAML defaults to `allow_unicode=False`, which escapes non-ASCII characters (e.g. "López" → "L\xF3pez") regardless of file encoding. Add `allow_unicode=True` to all yaml.dump/safe_dump calls that write apm.yml files.
4b9fb8d to
9e28bfe
Compare
|
@alopezsanchez thank you for this fix! can you answer to accept the CLA as requested by the bot? I'll get this merged. Thanks! |
Description
PyYAML defaults to
allow_unicode=False, which escapes non-ASCII characters (e.g. "López" → "L\xF3pez") regardless of file encoding. Addallow_unicode=Trueto all yaml.dump/safe_dump calls that write apm.yml files.Fixes #387 387
Type of change
Testing