Skip to content

RemoveUnicodeCharacters: support Subtitle Edit Batch convert - #335

Merged
niksedk merged 1 commit into
mainfrom
claude/remove-unicode-characters-batch
Oct 14, 2026
Merged

niksedk merged 1 commit into
mainfrom
claude/remove-unicode-characters-batch

Conversation

@niksedk

@niksedk niksedk commented Oct 14, 2026

Copy link
Copy Markdown
Member

Adds Batch convert support (SubtitleEdit/subtitleedit#16036) to the SE5 Remove Unicode characters plugin.

What it does

  • plugin.json: "batch": true.
  • batch (headless, all lines): replaces only the characters in a batch list; every other character is kept. Paragraph requests return paragraphs in the source format (styles/actors etc. kept); legacy requests fall back to SubRip. Nothing to change → ok without subtitle. Settings are not returned.
  • configure: the window opens in a settings-only state: a "Batch convert settings" panel, the batch list as rows (count/lines columns hidden), an Add box that takes pasted glyphs or U+XXXX codes (for invisible characters like U+200B), and an opt-in "Also remove every other non-ANSI character". OK is always enabled and returns settings + settingsVersion, no subtitle. Cancel → cancelled.

The judgement call: batch default

The window preselects every detected character with a blank replacement, i.e. "remove all above U+00FF". Doing that unattended would wipe Cyrillic, Greek, CJK, curly quotes, dashes, ellipses etc. from whole folders, so batch does not mirror the window's preselection here:

  • Until Configure is used, the batch list = built-in defaults (♪, ♫ → #) plus every non-blank replacement the user typed in the window. Blank window entries are ignored, because the window saves a blank entry for every row shown, including rows the user left unchecked, so a blank is no proof the user wants that character removed.
  • Once configured, the list is exactly what was saved. The SE4-style "remove everything" behaviour is available only as an explicit Configure option.
  • The batch list and option are saved under separate keys (batchReplacements, batchRemoveOthers); a normal run keeps them but ignores them, and Configure keeps the window's replacements.

SE 5.3 compatibility

Old SE ignores batch and only sends run; the run path is unchanged (the only difference is that the saved settings now also carry the batch keys through).

Tests

  • New se5/RemoveUnicodeCharacters.Tests (xUnit, modelled on FixEncodingErrors.Tests) with BatchModeTests (9 tests): defaults-only batch, nothing-to-change, blank window entries ignored, configured list, remove-others, legacy SubRip, settings round-trips both ways, U+XXXX parsing.
  • The workflow gets a test job (build depends on it) and the Tests path filter.
  • End-to-end: ran the built dll with a batch request.json → exit 0, ♪ Привет ♫ → # Привет #, don’t → don't (saved replacement).
  • Not verified: the Configure window and the run window were not opened by hand (no headless UI run).

🤖 Generated with Claude Code

- plugin.json "batch": true
- batch request: replace only the characters in a batch list (default
  ♪/♫ -> # plus non-blank window replacements), keep all others, no UI
- configure request: edit the batch list (add by glyph or U+XXXX) and an
  opt-in "remove every other non-ANSI character"; saved under batch-only
  keys that a normal run keeps but ignores
- new RemoveUnicodeCharacters.Tests project, run by the workflow

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@niksedk
niksedk merged commit ffe7899 into main Oct 14, 2026
10 checks passed
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.

1 participant