isprintable
Isprintable — the node that finds the invisible junk in your text
- BOOLEAN
Strings that come from the outside world carry baggage. Load text from a file or an API and you can end up with a newline you never asked for, a stray tab, or an actual control character riding along in the middle of your prompt. isprintable answers "does this string contain anything that isn't printable?" - a surprisingly useful thing to ask right before you put a string somewhere it shouldn't be, like a filename or a prompt field.
It's one of those nodes you don't think you need until the first time a hidden character silently breaks something and you spend an hour hunting it. Then it becomes the front door to your text-cleaning chain.
How it works
Python's str.isprintable(). Returns True if every character in the string is printable, False if any character is a control character. Control characters are the invisible stuff - newlines (\n), tabs (\t), NUL bytes (\x00), escape sequences. Quick sanity check:
"hello"→True"café"→True(accented letters are fine, they're not control chars)"a\nb"→False"a\tb"→False""→True
That last one is the family quirk: isprintable is the only one of the is* checks where the empty string returns True. Every other check in this family requires at least one character and bails to False on "". Here, an empty string has nothing unprintable in it, so it's True.
Inputs and outputs
One required input, string (default ""), and one BOOLEAN output. The output feeds a conditional: on False, route the string through a cleaning step (strip newlines, or this pack's replace/escape nodes) or reject it outright.
Installing it
Ships in the Basic data handling pack by StableLlama. ComfyUI Manager: search "Basic data handling". Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
Restart ComfyUI and you'll find it under Basic/STRING/is. The pack is pure Python with no dependencies and no downloads - nothing to break, nothing to resolve.
Common issues
The realistic case that trips people is reading a text file and finding isprintable returns False because the file ends with a newline. That's not corruption, that's just how files are. Strip first, check after. And remember the empty-string behavior cuts the other way from the rest of the family - if you're treating False as "this string is bad", an empty string won't be flagged, because it's True. If you care about empty, pair this with the pack's length node (length 0) rather than assuming printable implies non-empty.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| string | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |