Skip to content

feat: add Escape Smart Characters operation#2274

Draft
min23asdw wants to merge 2 commits intogchq:masterfrom
min23asdw:feat/escape-smart-characters
Draft

feat: add Escape Smart Characters operation#2274
min23asdw wants to merge 2 commits intogchq:masterfrom
min23asdw:feat/escape-smart-characters

Conversation

@min23asdw
Copy link
Copy Markdown

Summary

Adds a new Escape Smart Characters operation that converts typographic/smart characters to their plain ASCII equivalents.

  • Curly quotes (""'') → straight quotes (""'')
  • Em/en dashes (—–) → ASCII dashes (---)
  • Arrows (→←↔⇒) → ASCII arrows (--><--<->==> )
  • Symbols (©®™) → ASCII ((C)(R)(TM))
  • Ellipsis () → ...
  • Non-breaking space → regular space
  • And many more (60+ mappings)

For characters with no obvious ASCII equivalent (e.g. ☣), the user can choose:

  • Include — keep as-is (default)
  • Remove — strip from output
  • Replace with '.' — substitute with a dot

This follows the spec from the original issue discussion.

Closes #419
Ref: #1291 (closed due to repository inactivity, not code issues)

Changes

File Change
src/core/operations/EscapeSmartCharacters.mjs New operation
tests/operations/tests/EscapeSmartCharacters.mjs 9 test cases
src/core/config/Categories.json Register in "Data format" category
tests/operations/index.mjs Import test file

Test plan

  • npx grunt lint — passes
  • npm test — 1905/1905 passing (Node 18)
  • Verify operation appears in CyberChef UI under "Data format"
  • Test with real-world smart character input (e.g. text copied from Word/Google Docs)
  • Verify each option (Include / Remove / Replace) works correctly

Converts smart characters (curly quotes, em/en dashes, arrows,
copyright signs, ellipses, etc.) to plain ASCII equivalents.

For characters with no obvious ASCII mapping, the user can choose
to Include (keep as-is), Remove, or Replace with '.'.

Closes gchq#419
Ref: gchq#1291 (closed due to inactivity)
@min23asdw min23asdw marked this pull request as draft March 23, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Operation request: Escape Smart Characters

2 participants