caca_charset(3caca)
π caca_charset(3caca) β libcaca character set conversions π
okay so bestie, welcome to the libcaca page for caca_charset(3caca). It's giving character-set conversion central, and we're about to make UTF-8, UTF-32, CP437 and ASCII make sense. β¨
β¨ NAME β¨
caca_charset β libcaca character set conversions
πΈ SYNOPSIS πΈ
π Topics π
libcaca primitives drawing
π¦ Functions π¦
__extern uint32_t caca_utf8_to_utf32 (char const *, size_t *)β Convert a UTF-8 character to UTF-32.__extern size_t caca_utf32_to_utf8 (char *, uint32_t)β Convert a UTF-32 character to UTF-8.__extern uint8_t caca_utf32_to_cp437 (uint32_t)β Convert a UTF-32 character to CP437.__extern uint32_t caca_cp437_to_utf32 (uint8_t)β Convert a CP437 character to UTF-32.__extern char caca_utf32_to_ascii (uint32_t)β Convert a UTF-32 character to ASCII.__extern int caca_utf32_is_fullwidth (uint32_t)β Tell whether a UTF-32 character is fullwidth.
π Detailed Description π
These functions perform conversions between usual character sets. lowkey iconic, highkey useful. π«Ά
π₯ Function Documentation π₯
π __extern uint32_t caca_utf8_to_utf32 (char const * s, size_t * bytes) π
Convert a UTF-8 character read from a string and return its value in the UTF-32 character set. If the second argument is not null, the total number of read bytes is written in it.
If a null byte was reached before the expected end of the UTF-8 sequence, this function returns zero and the number of read bytes is set to zero.
This function never fails, but its behaviour with illegal UTF-8 sequences is undefined. undefined is undefined, bestie. π
π Parameters
- s β A string containing the UTF-8 character.
- bytes β A pointer to a
size_tto store the number of bytes in the character, orNULL.
π Returns
The corresponding UTF-32 character, or zero if the character is incomplete.
Referenced by caca_put_str().
π§ __extern size_t caca_utf32_to_utf8 (char * buf, uint32_t ch) π§
Convert a UTF-32 character read from a string and write its value in the UTF-8 character set into the given buffer.
This function never fails, but its behaviour with illegal UTF-32 characters is undefined.
π Parameters
- buf β A pointer to a character buffer where the UTF-8 sequence will be written.
- ch β The UTF-32 character.
π Returns
The number of bytes written.
π __extern uint8_t caca_utf32_to_cp437 (uint32_t ch) π
Convert a UTF-32 character read from a string and return its value in the CP437 character set, or "?" if the character has no equivalent.
This function never fails.
π Parameters
- ch β The UTF-32 character.
π Returns
The corresponding CP437 character, or "?" if not representable.
π __extern uint32_t caca_cp437_to_utf32 (uint8_t ch) π
Convert a CP437 character read from a string and return its value in the UTF-32 character set, or zero if the character is a CP437 control character.
This function never fails.
π Parameters
- ch β The CP437 character.
π Returns
The corresponding UTF-32 character, or zero if not representable.
π¦ __extern char caca_utf32_to_ascii (uint32_t ch) π¦
Convert a UTF-32 character into an ASCII character. When no equivalent exists, a graphically close equivalent is sought.
This function never fails, but its behaviour with illegal UTF-32 characters is undefined.
π Parameters
- ch β The UTF-32 character.
π Returns
The corresponding ASCII character, or a graphically close equivalent if found, or "?" if not representable.
π __extern int caca_utf32_is_fullwidth (uint32_t ch) π
Check whether the given UTF-32 character should be printed at twice the normal width (fullwidth characters). If the character is unknown or if its status cannot be decided, it is treated as a standard-width character.
This function never fails.
π Parameters
- ch β The UTF-32 character.
π Returns
1 if the character is fullwidth, 0 otherwise.
Referenced by caca_put_char(), and caca_put_str().
πΈ Author πΈ
Generated automatically by Doxygen for libcaca from the source code.
π cute sign-off: this page is from libcaca version 0.99.beta20, dated Wed May 13 2026 09:45:08. byeee, go convert some characters πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: libcaca-devel 0.99.beta20-160000.3.1 Β· WTFPL
- opensuse-leap 16.0: libcaca-devel 0.99.beta20-160000.3.1 Β· WTFPL
- opensuse-leap 16.0: libcaca-devel 0.99.beta20-160000.3.1 Β· WTFPL
- opensuse-leap 16.0: libcaca-devel 0.99.beta20-160000.3.1 Β· WTFPL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms