-
Notifications
You must be signed in to change notification settings - Fork 46
Description
Describe the bug
When apm init (or apm install in zero-config mode) auto-detects the git user.name and writes the author field to apm.yml, non-ASCII characters are escaped as \xNN sequences instead of being written as proper UTF-8.
For example, a git user named Alejandro López Sánchez produces:
author: "Alejandro L\xF3pez S\xE1nchez"This is caused by PyYAML's yaml.safe_dump() / yaml.dump() defaulting to allow_unicode=False, which forces ASCII-safe escaping regardless of file encoding.
The same issue affects any code path that re-writes apm.yml (install, uninstall, script runner), since round-tripping through PyYAML without allow_unicode=True will re-escape any non-ASCII content.
To Reproduce
- Configure git with a non-ASCII name:
git config user.name "Alejandro López Sánchez" - Run apm init --yes in a new directory
- Open the generated apm.yml
- The author field contains escaped sequences: "Pepe Rodríguez"
Expected behavior
The author field should contain the actual UTF-8 characters:
author: Alejandro López SánchezEnvironment (please complete the following information):
- OS: Any (reproduced on macOS)
- Python Version: 3.12
- APM Version: 0.8.3
- VSCode Version: N/A
Logs
No error is raised — the YAML is technically valid, but the human-readable content is garbled.