Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved blocking issues were identified.
Pull request overview
Fixes Unicode corruption in double-quoted environment values while preserving escape handling.
Changes:
- Protects backslashes before literal Unicode.
- Decodes Unicode through a single ASCII-escape pass.
- Adds comprehensive parser and CLI regression tests.
File summaries
| File | Summary |
|---|---|
tests/test_env_unicode.py |
Adds Unicode, escape, error-precedence, and CLI coverage. |
jinja2cli/cli.py |
Updates double-quoted environment value decoding. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Double-quoted env values containing literal Unicode are corrupted by encoding them as UTF-8 and then decoding those bytes with
unicode-escape. For example,NAME="café\n中文 😀"renders mojibake instead of the original characters and a newline.Protect unpaired backslashes directly before literal non-ASCII characters, then encode Unicode as ASCII character escapes and decode the whole value with the existing codec once. Single-quoted and unquoted values remain unchanged. A single codec call preserves error precedence even when Unicode separates an unknown escape from a malformed one and warnings are treated as errors.
Added 26 test cases covering accents, CJK, emoji, combining characters, escapes, adjacent backslashes, controls, mixed-Unicode error precedence, and rendering a real template with synthetic env data.
Validation: 79 pytest tests passed on Windows with Python 3.9.13 and 3.14.4; Ruff check/format passed; ty passed targeting Linux, as used by CI. Native Windows ty reports a pre-existing
nt._supports_virtual_terminaltyping error. The Bats suite could not start under local Git Bash because its source-file symlink creation failed; it is not claimed as passing.The Linux ty target is a static type-check setting, not a Linux runtime test. All 42 Bats tests remained unstarted. Hosted CI and the full supported Python matrix have not been verified. This fixes a separate decoding defect and does not implement the environment-import feature discussed in #142.