Makes text that came from the network safe to show.
Names of servers, groups, clients and streams, and service names from mDNS are written by whoever runs the machine (or by someone who pretends to): control characters, line and paragraph separators, bidi controls, the C1 range, invisible format characters (zero width, soft hyphen, word joiner, the deprecated U+2065 to U+206F, and every other character of the general category Cf), the letters that draw nothing (Hangul fillers, Braille blank, Khmer inherent vowels, combining grapheme joiner), tag characters and unpaired surrogates become ?, and the text is cut. A text of white space only is the empty string (a name that shows nothing is no name). The result is display text only: never an identity, never a log line.
| static String de.yaacc.snapcast.control.SnapcastDisplayText.toastReason |
( |
String | reason, |
|
|
int | maxCodePoints ) |
|
static |
The server's own words, as little of them as makes sense in a toast that looks like the app's: characters of the category "format" and the invisible ones (zero width space and joiners, word joiner and invisible operators, soft hyphen, byte order mark, bidi controls) are removed, and at most maxCodePoints code points are kept (a pair is never cut).
Control characters and line separators must be replaced before (the stream handling and of do that). Empty when nothing is left.