string_unescape(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« string_unescape(9) πŸ’«

okay bestie, welcome to the Kernel API Manual entry for string_unescape β€” yes it's a real one and yes it's lowkey iconic πŸŽ€


✨ NAME ✨

string_unescape β€” unquote characters in the given string

like, it takes your escaped little string and un-escapes it. that's the whole vibe. πŸ’…


🌸 SYNOPSIS 🌸

int string_unescape(char *src, char *dst, size_t size, unsigned int flags);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • src β€” the source buffer (escaped). this is the one with all the backslash-y drama going on πŸ™ˆ
  • dst β€” the destination buffer (unescaped). where the chill, de-escaped version ends up πŸ’–
  • size β€” size of the destination buffer (0 to unlimit). yes, 0 literally means no limit, she's quirky like that ✨
  • flags β€” combination of the flags. pick your faves, stack 'em, go off πŸ‘‘

πŸ’œ DESCRIPTION πŸ’œ

The function unquotes characters in the given string. simple as that, no cap.

Because the size of the output will be the same as or less than the size of the input, the transformation may be performed in place β€” so yes bestie, src and dst can literally be the same buffer. main character energy fr fr πŸ”₯

Caller must provide valid source and destination pointers. be so serious about this, no funny business with the pointers pls 😭

Be aware that the destination buffer will always be NULL-terminated. Source string must be NULL-terminated as well. both of them, terminated, non-negotiable 🫢

The supported flags are:

  • UNESCAPE_SPACE β€” handles the whitespace girlies:
    • '\f' β€” form feed
    • '\r' β€” carriage return
    • '\n' β€” newline
    • '\t' β€” horizontal tab
    • '\v' β€” vertical tab
  • UNESCAPE_OCTAL β€” '\NNN' β€” byte with octal value NNN (1 to 3 digits)
  • UNESCAPE_HEX β€” '\xHH' β€” byte with hexadecimal value HH (1 to 2 digits)
  • UNESCAPE_SPECIAL β€” the special ones, the celebrities ✨:
    • '\"' β€” double quote
    • '\\' β€” backslash
    • '\a' β€” alert (BEL)
    • '\e' β€” escape
  • UNESCAPE_ANY β€” all previous together. the "why choose" option, she ate πŸ’…

🌈 RETURN 🌈

The amount of the characters processed to the destination buffer excluding trailing '\0' is returned. so like, count everything except the terminator bestie, we don't count the terminator πŸŽ€


πŸ’€ SEE ALSO πŸ’€

Kernel file ./lib/string_helpers.c, plus the whole friend group:


okay that's the whole page, you're officially fluent in string_unescape πŸ§šβ€β™€οΈ this gem lives over in ./lib, dated October 2026, and it's filed under string_unescape(9) β€” go forth and unescape responsibly bestie, ily, bye πŸ’–β­πŸ“

πŸ“¦ where this page comes from