Skip to content

[Question] Encoding defense: PowerShell -> Git mojibake prevention (5-layer) #387

Description

@gugu23456789

Question Category | 问题类别

Compatibility / Integration | 兼容性 / 集成确认

Your Question | 你的问题

Problem

PowerShell 5.1 on Windows defaults to Windows-1252 (ANSI) encoding for BOM-less files. When UTF-8 source files pass through the PowerShell pipeline, multi-byte sequences (e.g. em dash = 0xE2 0x80 0x94) get misinterpreted as Windows-1252 then re-encoded as CJK mojibake.

This corrupts docstring comments and markdown files without affecting code functionality, making it invisible to CI until editors display the garbage characters.

5-Layer Defense (discovered and implemented in PR #339)

Layer Defense Mechanism One-time?
L5 CI Mojibake Check Byte-level non-ASCII scan on .py/.ts files Per CI run
L4 Pipeline encoding Out-File / ConvertFrom-Json with explicit -Encoding utf8 Per pipeline
L3 Shell bypass git commit -F msg.txt instead of -m "..." Per command
L2 Git config core.quotepath false + i18n.commitEncoding utf-8 Yes
L1 UTF-8 BOM 0xEF 0xBB 0xBF header on .ps1 files Yes

Implementation

Root Cause Reference

Relates to

Context / Background | 背景信息

No response


Expanded: Broader CI infrastructure gap

This issue was originally filed about encoding defense, but investigation revealed a broader infrastructure problem affecting all fork PRs.

Current upstream CI status (.github/workflows/pr-ci.yml on main)

Job Upstream PR #339 (fork)
Install OK OK
Pack OK OK
Manifest OK OK
Size Guard OK OK
Test TS MISSING OK (29 tests)
Test Python MISSING OK (import + SHA256)
Encoding Defense MISSING OK (L1+L5)
Node version 22 24

Cross-fork PR CI reporting

The upstream CI workflow triggers on pull_request but does not report status back to fork PRs. All 20+ Rhino Bird participants' PRs show zero CI checks on the PR page.

# PR Author Status Checks
#339 gugu23456789 0 reported (7 pass on fork)
#359 coder-mtj 0 reported
#385 rainforest888 0 reported
#362 ceilf6 0 reported
... all others 0 reported

Impact

  • Contributors cannot know if their changes break existing tests
  • Encoding mojibake enters the codebase undetected
  • No regression protection for Python or TypeScript code

Suggested fix

  1. Merge a baseline pr-ci.yml into main that includes Test TS + Test Python jobs
  2. Ensure the workflow has proper permissions to report status to fork PRs
  3. Consider adding Encoding Defense (L1+L5) as shown in PR feat(adapter): add bridge_adapter Python SDK + TypeScript MemoryAdapter interface #339
  4. Upgrade Node from 22 to 24 (LTS)

Ref: PR #339 demonstrates a fully working CI pipeline with all 8 jobs passing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions