vc_translate_unicode(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ vc_translate_unicode(9) β€” Kernel API Manual ✨

okay so bestie, this is the page for vc_translate_unicode, straight out of the Kernel API Manual πŸ’… and it's literally the little function that stitches UTF-8 bytes together into a Unicode code point for the virtual console. grab a strawberry πŸ“ and let's go.


🌸 SYNOPSIS 🌸

int vc_translate_unicode (struct vc_data *vc , int c , bool *rescan );

πŸŽ€ ARGUMENTS πŸŽ€

  • vc β€” the virtual console, obvs. it's the whole struct vc_data * situation.
  • c β€” the UTF-8 byte you want translated. one single byte, bestie.
  • rescan β€” gets set to true iff c wasn't consumed here and needs to be re-processed. so if this flips to true, that byte is coming back for round two πŸ™ˆ.

πŸ’– DESCRIPTION πŸ’–

so here's the tea β€” this function is building up a code point byte by byte, and it keeps its little bookkeeping in the vc_data struct:

  • vc_data.vc_utf_char is the being-constructed Unicode code point. the main character of the whole operation πŸ‘‘.
  • vc_data.vc_utf_count is the number of continuation bytes still expected to arrive. the countdown ⏳.
  • vc_data.vc_npar is the number of continuation bytes arrived so far. the tally so far πŸ“Š.

πŸ”₯ RETURN πŸ”₯

the returns are giving very specific, so listen up:

  • -1 β€” input OK so far, c consumed, further bytes expected. we're mid-vibe, keep the bytes coming ✨.
  • 0xFFFD β€” two whole possibilities, and yes you need to know both:
    • Possibility 1: input invalid, c may have been consumed (see desc. of rescan). πŸ‘€
    • Possibility 2: input OK, c consumed, and U+FFFD is the resulting code point. U+FFFD is valid, REPLACEMENT CHARACTER . not a bug, that's just what it is 🫢.
  • otherwise β€” input OK, c consumed, resulting code point returned. slay, we got the whole character πŸŽ‰.

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./drivers/tty/vt/vt.c plus a whole friend group of functions: vc_font_pitch(9), vc_font_size(9), vc_do_resize(9), __vc_resize(9), vt_resize(9), enum vc_ctl_state(9), vc_sanitize_unicode(9), vt_kmsg_redirect(9), con_is_bound(9), con_is_visible(9), con_debug_enter(9), con_debug_leave(9), do_unregister_con_driver(9).


fr fr, rescan is the one to watch β€” if it's true, that byte did NOT get eaten here and needs re-processing. no cap.

that's the whole page, bestie πŸ’œ β€” sourced from ./drivers/tty/vt, dated October 2026, and it's the vc_translate_unicode(9) page from the Kernel API Manual. mwah, go read some more kernel docs πŸ§šβ€β™€οΈπŸŒΈ

πŸ“¦ where this page comes from