Skip to content

seconv: reject unknown --encoding values, add --encoding:source#11045

Merged
niksedk merged 2 commits into
mainfrom
seconv-encoding-validation-and-source
May 19, 2026
Merged

seconv: reject unknown --encoding values, add --encoding:source#11045
niksedk merged 2 commits into
mainfrom
seconv-encoding-validation-and-source

Conversation

@niksedk
Copy link
Copy Markdown
Member

@niksedk niksedk commented May 19, 2026

Summary

  • Fail fast on a typo in --encoding (mirrors the existing --input-encoding-fallback validation) instead of silently substituting UTF-8 and producing mojibake. Error message hints at the new source value and seconv list-encodings.
  • Add --encoding:source — a sentinel that resolves per-file to the input file's detected encoding (preserving UTF-8 BOM vs. no-BOM), restoring the behavior the old SE CLI offered.

Addresses points 4 and 5 of #11037.

Test plan

  • seconv file.srt sami --encoding:NONSENSE exits 1 with a clear error
  • seconv file.srt sami --encoding:utf-8 still works (regression)
  • --encoding:source on a UTF-8-with-BOM input preserves the BOM on output
  • --encoding:source on a UTF-8-no-BOM input preserves no-BOM on output
  • --encoding:source --input-encoding-fallback:windows-1252 round-trips Windows-1252 bytes correctly
  • --encoding:SOURCE (case-insensitive) works
  • Help text and docs mention source

🤖 Generated with Claude Code

niksedk and others added 2 commits May 19, 2026 06:38
A typo like --encoding:NONSENSE was silently substituted with UTF-8,
producing mojibake without any indication. Validate the value the same
way --input-encoding-fallback already does and exit 1 on a bad name.

Also adds --encoding:source — a sentinel that resolves per-file to the
input's detected encoding (BOM/no-BOM preserved for UTF-8), restoring
the behavior the old SE CLI offered.

Fixes #11037 (points 4 and 5)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@niksedk niksedk merged commit 7cc964d into main May 19, 2026
1 of 3 checks passed
@niksedk niksedk deleted the seconv-encoding-validation-and-source branch May 19, 2026 04:40
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.

2 participants