al_ustr_encode_utf16(3alleg5)
π 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 thenparameter is smaller than that minimum, the string will be truncated. Not ideal but it's still always0terminated, so at least she's well-behaved about it. π«Ά
π SEE ALSO π
al_ustr_size_utf16(3alleg5)β the one who tells you how much room you actually need πal_utf16_encode(3alleg5)β her cousin, also doing UTF-16 things β¨
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
- debian trixie: allegro5-doc 2:5.2.10.1+dfsg-1 Β· Zlib
- ubuntu questing: allegro5-doc 2:5.2.10.1+dfsg-1build1
- ubuntu resolute: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- ubuntu stonking: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms