char2uni(3x)
π¦ char2uni(3x) π¦ β the AfterStep X11 window manager girlies know
okay so bestie, real talk: this page is char2uni(3x) from the AfterStep X11 window manager docs, and it's all about Unicode, UTF-8, and localized 8-bit encodings. it's short, it's iconic, it ate. let's get into it π
β¨ NAME β¨
char2uniβ handling on Unicode, UTF-8 and localized 8 bit encodingslibAfterImage/CHAR_SIZE
π NAMECHAR_SIZE π
so CHAR_SIZE is a convenient macro and its whole vibe is: we need to transparently determine the number of bytes that character spans. that's it, that's the job. π«Ά
and here's the tea β it assumes UTF-8 encoding when I18N is enabled. no cap. π
π₯ SOURCE π₯
this is the source, verbatim, every last character, do not touch, she is perfect:
/* size of the UTF-8 encoded character is based on value of
* the first byte : */ #define UTF8_CHAR_SIZE(c)
((((c)&0xC0)==0xC0)? \
(((c)&0x20)? \
(((c)&0x10)? \
(((c)&0x08)? \
(((c)&0x04)?6:5):4):3):2):1) #ifdef
WIN32 #define UNICODE_CHAR_SIZE(c) sizeof(UNICODE_CHAR) #endif
#define CHAR_SIZE(c) 1
likeβ¦ the way that UTF8_CHAR_SIZE peeks at the value of the first byte to figure out the size of the UTF-8 encoded character? obsessed. πβ¨ and UNICODE_CHAR_SIZE straight up hands you sizeof(UNICODE_CHAR), while CHAR_SIZE is just chillin' at 1. slay. π
π that's literally the whole page, bestie. nothing more, nothing less, and we love a concise queen.
sign-off π§ β this lil masterpiece comes to you courtesy of the 3rd Berkeley Distribution and AfterStep v.2.2.12. char2uni(3x), periodt. πΈπ¦β
π¦ where this page comes from
- ubuntu resolute: libafterimage-dev 2.2.12-19 Β· GPL-2.0-or-later
- ubuntu stonking: libafterimage-dev 2.2.12-19 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms