Escape Sequence Converter (Safe)
Turn Literal \\n Into Real Newlines Without Touching Anything Else
- STRING
If you've ever pulled a prompt out of a file or an API and found it full of literal \n and \t that display as backslash-letter pairs instead of actual line breaks, you've met the problem this node exists to solve. Escape Sequence Converter turns those escaped characters into the real thing - but only the ones that are safe, which is the whole point of the "Safe" in its display name.
It's a one-trick node from artyclaw/artyclaw-comfy, and it's the rare case where the display name is more honest than the source: registered as EscapeSequenceConverter, shown in the menu as "Escape Sequence Converter (Safe)". The "safe" isn't marketing - it's a design decision encoded in the code.
How it works
Exactly three replacements happen, and nothing else:
| Literal text | Becomes |
|---|---|
| \\n (backslash-n) | newline |
| \\r (backslash-r) | carriage return |
| \\t (backslash-t) | tab |
The key detail is that it only converts the double-backslash forms - the sequences that already made it through one level of escaping and are sitting there as visible text. It deliberately does not touch single-backslash sequences, because a single backslash in a file path (C:\models\foo.safetensors) or a regex (\d+) is meaningful and mangling it would corrupt your string. That conservative behavior is the entire reason it's marked safe: it can't break anything you didn't explicitly write as \\n.
Inputs and output
One input, text (multiline), and one STRING output that carries the converted text. Wire the output wherever the un-escaped version needs to go - typically a CLIP text encode, a prompt composer, or another text node further down the chain. That's the entire surface area. No seed, no options, nothing to misconfigure.
Install
ComfyUI Manager → search ArtyClaw Comfy Nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/artyclaw/artyclaw-comfy
Restart. Pure Python stdlib (re), zero dependencies.
Where people get burned
The mismatch between input and output is the usual surprise: you type \n (one backslash) in the input box expecting a newline and nothing happens, because that's a single-backslash sequence and this node won't touch it. It's working correctly - it's for strings that arrived already escaped, like a JSON payload or a config value where the newline is stored as the two characters \n. If your input is genuinely double-escaped (\\n in the raw string), the output will have real newlines where those pairs were. There's no visible preview of the converted result, so when in doubt, pipe the output into a text-display node or Debug Text Saver to see what you actually got. It's a tiny utility, but when you need it, nothing else in the pack does this one thing as narrowly.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |