al_ustr_encode_utf16(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸŽ€ NAME πŸŽ€

al_ustr_encode_utf16 β€” bestie, this is the Allegro 5 API and it's literally here to turn your string into UTF-16 bytes. No cap. πŸ’–

This page lives in the al_ustr_encode_utf16(3alleg5) manual, so if you ever need to find it again, that's the name, iykyk.


✨ SYNOPSIS ✨

#include <allegro5/allegro.h>

size_t al_ustr_encode_utf16(const ALLEGRO_USTR *us, uint16_t *s,
   size_t n)

Look at her. Iconic signature. Not a single character changed. πŸ’…


🌸 DESCRIPTION 🌸

Okay so here's the tea: al_ustr_encode_utf16 takes your string and encodes it into the buffer you hand it, in UTF-16. πŸ¦‹

It returns the number of bytes written. That's the number of bytes, bestie, not vibes.

There are never more than n bytes written. Periodt. So your buffer is safe, she respects the boundary. πŸ’–

Wanna know the minimum size you'd need to encode the complete string, like all of it, no truncation, main character energy? That's what al_ustr_size_utf16(3alleg5) is for β€” go query it. πŸ”

But listen: if the n parameter is smaller than that minimum, the string will be truncated. Not ideal but it's still always 0 terminated, so at least she's well-behaved about it. 🫢

🌈 SEE ALSO 🌈


And that's the whole page, bestie!! πŸŽ€ This was the Allegro reference manual talking about al_ustr_encode_utf16(3alleg5) β€” go forth and encode responsibly. Slay. πŸ’…πŸŒŸ

πŸ“¦ where this page comes from