fix(pwsh): self-build scripts set UTF-8 console so CLI emojis render#98
fix(pwsh): self-build scripts set UTF-8 console so CLI emojis render#98PrzemyslawKlys merged 1 commit intomainfrom
Conversation
Pull Request Review: Fix UTF-8 console encoding for emoji renderingSummaryThis PR addresses garbled emoji rendering when running build scripts from Windows PowerShell by temporarily switching the console codepage to UTF-8 and replacing raw emoji literals with character codes. Code Quality & Best Practices ✅Strengths:
Minor suggestions:
Potential Issues 🟡1. Silent failure on encoding setupIf the encoding setup fails, the script continues but emojis may still be garbled. Consider adding Write-Debug in the catch block. 2. Codepage restoration (Build-ModuleSelf.ps1:137)The check if ($oldConsoleCodePage) will be false if the original codepage was 0 (unlikely but theoretically possible). Use explicit null check: if ($null -ne $oldConsoleCodePage) 3. Character code compatibility (Build-PowerForge.ps1:23)The comment no VS16 suggests this is intentionally the base emoji without variation selector. This is correct for PS5.1 compatibility. Performance Considerations ✅
Security Concerns ✅
Test Coverage 🟡No automated tests for this functionality. Consider adding manual test cases to verify emoji rendering in PS5.1 on Windows and that console encoding is restored after script execution. Additional ObservationsPositive patterns:
Questions for author:
Overall AssessmentThis is a well-implemented fix for a legitimate issue. The approach is sound, the code is clean, and the implementation is consistent. The minor suggestions above are refinements rather than blockers. Recommendation: Approve with minor suggestions The PR successfully addresses the stated problem and follows repository conventions. The suggestions around error handling and null checking are defensive improvements that would make the code more robust but are not critical for merging. Review generated with assistance from Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 459403a135
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function Write-Ok($t) { Write-Host "✅ $t" -ForegroundColor Green } | ||
| function Write-Step($t) { Write-Host "🛠️ $t" -ForegroundColor Yellow } | ||
| function Write-Ok($t) { Write-Host ("{0} {1}" -f ([char]0x2705), $t) -ForegroundColor Green } # ✅ | ||
| function Write-Step($t) { Write-Host ("{0} {1}" -f ([char]0x1F6E0), $t) -ForegroundColor Yellow } # 🛠 (no VS16) |
There was a problem hiding this comment.
Use valid Unicode representation for wrench icon
[char] can only represent a single UTF-16 code unit, so [char]0x1F6E0 overflows and raises a conversion error at runtime. Because Write-Step is called immediately in this script, Build/Build-PowerForge.ps1 will fail before publishing starts in environments that execute this path. Please represent this symbol as a surrogate-pair string (or another safe string form) instead of a single [char] cast.
Useful? React with 👍 / 👎.
Fixes garbled Summary emojis when running Module\Build\Build-ModuleSelf.ps1 from Windows PowerShell by switching the console codepage to UTF-8 for the duration of the self-build run and restoring it afterward.\n\nAlso removes raw emoji literals from build scripts (uses [char] codes) so PS5.1 doesn't misread UTF-8-no-BOM scripts.