Skip to content

fix: support selectable UTF-8 and PC-ANSI/CP437 decoding for SOL - #1913

Open
nmgaston wants to merge 3 commits into
mainfrom
fix/sol-terminal-encoding
Open

nmgaston wants to merge 3 commits into
mainfrom
fix/sol-terminal-encoding

Conversation

@nmgaston

@nmgaston nmgaston commented Nov 9, 2026 •

Copy link
Copy Markdown

PR Checklist

  • Unit Tests have been added for new changes
  • API tests have been updated if applicable
  • All commented code has been removed
  • If you've added a dependency, you've ensured license is compatible with Apache 2.0 and clearly outlined the added dependency.

What are you changing?

The fix addresses a byte-versus-character decoding mismatch in SOL. Incoming data is delivered as a binary string, but the old processor handled each character independently: for high-bit bytes it masked off the high bit and looked up a character. That cannot decode multibyte UTF-8 correctly, and the old test showed the consequence: € was rendered as ¼.

The PR adds two selectable decoding paths:

  • VTUTF8 (1) converts the incoming string back to bytes and feeds them to a streaming TextDecoder. It preserves incomplete UTF-8 sequences between chunks, so a character split across WebSocket messages can still be decoded correctly. Invalid sequences produce replacement characters rather than corrupting subsequent text.

  • PCANSI (2) maps each byte from 0x80 to 0xFF through an explicit CP437 character table. ASCII bytes pass through unchanged, preserving terminal escape sequences and control data.

Changing modes—or resetting the processor—discards any incomplete UTF-8 sequence so bytes from different modes aren’t combined. The processor defaults to PC-ANSI. Separately, the redirector now reports complete SOL OEM capability bytes through a callback, allowing the caller to access the terminal capability information.

Anything the reviewer should know when reviewing this PR?

Tested with an ISM system using UTF8 and NUCs using PC-ANSI/CP437. Requires using webui PR mentioned below to select the different modes. This PR will be required to merge before the webui PR will successfully build.

If the there are associated PRs in other repositories, please link them here (i.e. device-management-toolkit/repo#365 )

(webui) device-management-toolkit/sample-web-ui#3699

@nmgaston
nmgaston force-pushed the fix/sol-terminal-encoding branch from dddeeac to c2e715a Compare November 9, 2026 17:59
Co-authored-by: Pola, Sudhir <sudhir.pola@intel.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nmgaston nmgaston changed the title Fix/sol terminal encoding fix: support selectable UTF-8 and PC-ANSI/CP437 decoding for SOL Nov 9, 2026
@nmgaston
nmgaston requested a balanced review from Copilot November 9, 2026 18:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are identified for the SOL encoding and capability callback changes.

No open issues 🎉

What changed in this PR

Adds selectable UTF-8 and PC-ANSI/CP437 decoding for Serial over LAN (SOL), with PC-ANSI as the default.

Changes:

  • Supports streaming UTF-8 decoding and CP437 mapping while preserving ASCII and terminal control sequences.
  • Exports terminal encoding options and exposes complete SOL OEM capability payloads through an optional callback.
  • Expands tests for chunk boundaries, malformed input, decoder resets, mode switching, and capability payload handling.
File Description
src/​test/​terminaldataprocessor.test.ts Tests decoding modes, malformed input, chunking, and reset behavior.
src/​test/​amtredirector.spec.ts Tests complete SOL capability payload delivery and KVM exclusion.
src/​core/​TerminalDataProcessor.ts Implements selectable decoding and removes special handling of literal J.
src/​core/​SolTerminalType.ts Defines UTF-8 and PC-ANSI terminal modes.
src/​core/​index.ts Exports SolTerminalType for consumers.
src/​core/​AMTRedirector.ts Adds the optional SOL OEM capability callback.

Review effort: Balanced

@nmgaston
nmgaston marked this pull request as ready for review November 10, 2026 22:26
@nmgaston
nmgaston requested review from madhavilosetty-intel, rdower, rsdmike and sudhir-intc and removed request for rdower November 10, 2026 22:31

@sudhir-intc sudhir-intc left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @nmgaston
I tried out the functionality using this PR and sample-UI PR and it LGTM .
Fixes two issues present on main.

  1. typing capital J was doing a clear screen.
  2. "sudo ./rpc amtinfo" was displaying garbled characters, now with the new options of changing SOL encoding to UTF-8" don't see this issue

One comment: On the Serial Over LAN screen I see the "Reset to BIOS may be needed .. " message. Why is this needed ? since even without reset the changes in encoding worked by disconnecting and connecting to SOL. This is something to be fixed in the sample-UI I think

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.

3 participants