Table of Contents

Method MakePrintable

Namespace
Terminal.Gui.Text
Assembly
Terminal.Gui.dll

MakePrintable(string)

Ensures the text does not contain control characters that could be emitted verbatim to the terminal, by translating C0 controls (U+0000–U+001F), DEL (U+007F), and C1 controls (U+0080–U+009F) to printable Unicode equivalents via the +U+2400 offset. Multi-character graphemes whose first character is a control are replaced with a space.

public static string MakePrintable(this string str)

Parameters

str string

The text.

Returns

string

A string safe for terminal display.

Remarks

This is a Terminal.Gui extension method to string to support TUI text manipulation.

Per UAX #29, control characters are always grapheme cluster boundaries. A well-formed grapheme cluster produced by GetTextElementEnumerator(string) cannot contain embedded controls, so only the first character needs to be checked.