IRC: mIRC colour and formatting codes are shown as control characters #91

Closed
opened 2026-09-02 23:25:36 -04:00 by Salastil · 1 comment
Owner

src/renderer/src/lib/format.ts handles Markdown and BBCode and knows nothing about IRC's own formatting: \x03 colour pairs, \x02 bold, \x1D italic, \x1F underline, \x16 reverse, \x0F reset.

On a channel where anyone uses colour - which is most of them, and every bot - the codes arrive as invisible or garbage characters inside the text.

Done looks like: the codes are parsed and rendered, with a setting to strip them instead (HexChat has exactly that switch), and the composer can send at least bold/italic/underline.

`src/renderer/src/lib/format.ts` handles Markdown and BBCode and knows nothing about IRC's own formatting: `\x03` colour pairs, `\x02` bold, `\x1D` italic, `\x1F` underline, `\x16` reverse, `\x0F` reset. On a channel where anyone uses colour - which is most of them, and every bot - the codes arrive as invisible or garbage characters inside the text. **Done looks like:** the codes are parsed and rendered, with a setting to strip them instead (HexChat has exactly that switch), and the composer can send at least bold/italic/underline.
Author
Owner

Finished. Bold, italic, underline, reverse, reset, and both colour forms — the numbered \x03fg,bg and the hex \x04RRGGBB — are rendered in mIRC's own palette, which is what every other client draws. A setting strips them instead, the same switch HexChat has and for the same reason.

Only IRC's traffic is drawn with them; everywhere else they are stripped, because a control character in a Discord message is something somebody pasted rather than formatting. The sanitiser learnt four more style properties to allow this, each validated against its own pattern — a style attribute on somebody else's message is a large surface.

nobilis f4c097c, moho https://git.salastil.com/Salastil/moho/commit/0d57bd0

Finished. Bold, italic, underline, reverse, reset, and both colour forms — the numbered `\x03fg,bg` and the hex `\x04RRGGBB` — are rendered in mIRC's own palette, which is what every other client draws. A setting strips them instead, the same switch HexChat has and for the same reason. Only IRC's traffic is drawn with them; everywhere else they are stripped, because a control character in a Discord message is something somebody pasted rather than formatting. The sanitiser learnt four more style properties to allow this, each validated against its own pattern — a style attribute on somebody else's message is a large surface. nobilis f4c097c, moho https://git.salastil.com/Salastil/moho/commit/0d57bd0
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Salastil/moho#91