Skip to content

Detect UTF-16 shebang BOMs - #2648

Merged
Widthdom merged 3 commits into
mainfrom
fix-issue1830
May 24, 2026
Merged

Detect UTF-16 shebang BOMs#2648
Widthdom merged 3 commits into
mainfrom
fix-issue1830

Conversation

@Widthdom

Copy link
Copy Markdown
Owner

Summary

  • Detect BOMs before decoding extensionless shebang probes.
  • Support UTF-8, UTF-8 BOM, UTF-16 LE, and UTF-16 BE shebang scripts without treating UTF-16 NUL bytes as binary content.
  • Add regression coverage for all supported shebang encodings.

Validation

  • dotnet build CodeIndex.sln -c Release -p:UseSharedCompilation=false
  • dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj -c Release --filter FileIndexerTests -p:UseSharedCompilation=false
  • dotnet test CodeIndex.sln -c Release -p:UseSharedCompilation=false
  • dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll status --check --json
  • Codex adversarial review: No blocking/actionable issues found.

Documentation and Changelog

  • Added changelog fragment: changelog.d/unreleased/1830.fixed.md
  • No README or guide update needed; this preserves existing shebang behavior and fixes an encoding-specific detection gap.

Fixes #1830

@Widthdom
Widthdom merged commit 432a467 into main May 24, 2026
10 checks passed
@Widthdom
Widthdom deleted the fix-issue1830 branch May 24, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detect UTF-16 BOM before decoding shebang line

1 participant